Debian RC Script Control

As a former Gentoo user, I had to learn the Ubuntu/Debian way to add service to a system runlevel. For my desktop, I never had to worry about it because, as usual with Ubuntu, a nice GUI is provided to manage startup services (System -> Administration -> Services). However when installing pyscrabble-server on my closet server I had to lookup the CLI tool for the job. (Note that I could have just used X11 forwarding to run the GUI tool, but that is just not nearly as cool and would have required lots of unnecessary GUI packages) It its simplest form, the comand to automatically start and stop /etc/init.d/SERVICE at startup and shutdown is simply:

sudo update-rc.d SERVICE defaults

From the man page:

If defaults is used then update-rc.d will make links to start the service in runlevels 2345 and to stop the service in runlevels 016.

For anything more complex, see the man page. Note that Debian has good bash completion support for the update-rc.d command.

If you’re adding your own home-brew service, you can always just add commands to /etc/rc.local and make that file executable.

This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.