This is a very simple example of an init.d-style daemon that uses the LSB helpers. It is a modified version of the script found at http://www.thegeekstuff.com/2012/03/lsbinit-script.
Assume we have a daemon helloworld.py
which can be invoked as (running at the foreground):
/path/to/helloworld.py /another-path/to/helloworld.ini
We want to wrap this daemon, say helloworld
, into a init.d-style script (e.g. to include it in the normal boot sequence). When done, the daemon will be managed in the usual manner:
invoke-rc.d helloworld {start|stop|reload|status}
The wrapper init.d script will (as usual) live under /etc/init.d/
.
Install the daemon under the proper runlevels (specified into the init.d script itself), i.e. create all needed symlinks into /etc/rc*.d
directories:
update-rc.d helloworld defaults
If needed, uninstall the daemon with:
update-rc.d helloworld remove