0

I have a service developed in DropWizard. I run the fat jar on an AWS server with the nohup command like this.

nohup java -jar myapp-0.0.1-SNAPSHOT.jar server my-configure.yml > outfile &

This works fine.

However, yesterday I tried to use the app that makes use of the service and it wasn't working. When I logged into the server I realized that the service was no longer running. It had been running for couple of months without any issues. In the logs (outfile) I just see the following:

INFO  [2014-11-13 19:48:31,978] org.eclipse.jetty.server.Server: Graceful shutdown SocketConnector@0.0.0.0:9001
INFO  [2014-11-13 19:48:31,987] org.eclipse.jetty.server.Server: Graceful shutdown InstrumentedBlockingChannelConnector@0.0.0.0:9000
INFO  [2014-11-13 19:48:31,988] org.eclipse.jetty.server.Server: Graceful shutdown o.e.j.s.ServletContextHandler{/,null}
INFO  [2014-11-13 19:48:31,988] org.eclipse.jetty.server.Server: Graceful shutdown o.e.j.s.ServletContextHandler{/,null}

Question

  1. How can I troubleshoot why the service stopped running?...could AWS server have been restarted?
  2. Is there a better way to do this that is not prone to errors like these
  3. Is there a way I can be notified when the service stopped running ...rather than checking it every so often...

Edit

Just checked uptime on the AWS server and it says up for 7 days. Which coincides with when the service went down. I guess the solution is to have the service start automatically on server restart.

birdy
  • 9,286
  • 24
  • 107
  • 171

1 Answers1

0

You can look at the solution used here to give yourself a notification when the program shuts down. It won't know it was called with nohup though, that's something for the shell. But a java solution might work for you.

Based on your edit, you might want to create an init.d script to start (and stop) your process: a template for that can be found here.

Community
  • 1
  • 1
Joeblade
  • 1,735
  • 14
  • 22