If all you're doing is start/stop/restart on Ubuntu you should take a look at Upstart[0]. See a simple example here: http://askubuntu.com/a/251581
upstart is deprecated.
Re:You don't need to daemonize
by vezzy-fnord on Sunday June 28, 2015 @07:31PM
(#9795580)
Not that I know of. ChromeOS still uses it and though Ubuntu is phasing it out, they haven't completely gotten rid of it as a session manager yet AFAIK. They need to support it for a few more years anyway due to 14.04 LTS.
That's exactly the difference between deprecated an obsolete. The former means it's on it's way to the latter. Putting work into upstart just means you'll have work migrating to systemd in less than a year or two.
I just needed to write a simple shell script ...
If one is using Ubuntu Linux, then it is daft to begin with System 5 rc scripts, given that one already has upstart on version 14 and has systemd on version 15. Ironically, those "basics" are the bits that one doesn't need to write at all. See http://unix.stackexchange.com/a/200281/5132 .
http://manpages.ubuntu.com/manpages/trusty/man8/update-rc.d....
I didn't do any daemonzing like we used to do in the C days so I'm not sure that the systemd approach mentioned in the article does it better (not against the idea, maybe it's needed on non-Ubuntu systems?).
I just needed to write a simple shell script with the basics and this:
...
...