I am using Ubuntu 14.04.3 on a server that runs a bunch of homemade web applications. I want each application to launch soon after the system launches—specifically, as soon as Postgresql is running—and then run until the system is shut down.
Right now I’m doing this with GNU Screen: I run each application in its own terminal “window”. This is straightforward, and it makes it easy to see any error output that gets generated, but it feels amateurish and I have to do it by hand each time the system is restarted.
I looked into writing Upstart configuration scripts for each application but I’d have to choose one of these unappealing options:
- System jobs are run by
rootand require that configuration files be installed in a system path.
- User jobs seem like what I want but they’re deprecated in recent versions of Upstart and apparently not even supported in Ubuntu.
- Session jobs are extremely finicky to set up if you’re running a server.
Apart from all of this, Upstart has already started to be replaced by systemd in recent versions of Ubuntu.
What is the recommended way to start a task such as I am describing? Should I bite the bullet and use an Upstart system job, or is there an easier way?