Linux – Ubuntu Daemon Best Practices

daemonjettylinuxserviceUbuntu

I have a RingoJS webserver (runs atop Jetty) that is part a an Apache reverse proxy setup.

I would like multiple Ringo processes to run autonomously in the background, startup automatically on reboot, etc. Basically, the same as Apache or Postgresql daemons would do.

I've investigated running processes in the background (via & or bg), nohup, and using screen to maintain multiple contexts. I'm not sure what the best practice here is.

I'd like to be able to easily identity (friendly name) each RingoJS process that is running. (one for each app). Then be able to start and stop them easily the way one does with apachectl or something. I'd like the processes to automatically startup on reboot, and not be affected by repeated ssh sessions.

Screen seems like a good choice but it's use case seems more for porting shell contexts then it does for maintaining long running system processes. I can run jobs in the background, but worry about zombie processes after logging out or cryptic PIDs that don't clearly identify which app/service is running.

Can anyone provide some pointers as to what I "should" be doing to achieve this outcome?

Thanks.

Best Answer

You should be creating an init service. Ubuntu uses upstart. http://upstart.ubuntu.com/

Related Topic