I have an app (in the form of a single binary) that I need to run on one of my servers, and I'd like to be able to control its lifecycle properly. What I'd like is the following:
- simple one command start/stop/restart
- as little configuration as possible, I don't want to setup big things like monit, or write 500 lines of shell scripts
- handle stdout/stderr/failures in a log file
- manage a pidfile in a way that there only is a pid file if the process is running (this seems to be really hard to do by hand using shell scripts correctly)
- (optional) be able to do something if the binary crashes
- (optional) start automatically if the server reboots and/or the application crashes
What I'm looking for is a lightweight solution that ideally works with Ubuntu Server out of the box, without much configuration.