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
- How can I troubleshoot why the service stopped running?...could AWS server have been restarted?
- Is there a better way to do this that is not prone to errors like these
- 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.