Debian uses a Sys-V like init system for executing commands when the system runlevel changes – for example at bootup and shutdown time. Its startup files are stored in /etc/init.d/ and symbolic linked within the /etc/rcX.d/ directories. Debian Linux comes with different utilities to manage these startup file, here we’ll show two examples on managing these system init scripts.
1, rcconf – http://packages.debian.org/lenny/rcconf
This tool configures system services in connection with system runlevels. It turns on/off services using the scripts in /etc/init.d/. Rcconf works with System-V style runlevel configuration. It is a Text User Interface (TUI) frontend to the update-rc.d command.
To start rcconf, login as root and type the command “rcconf“, then select the service that you would like to enable or disable, and press Tab to apply a change.
A similar command is sysv-rc-conf, you can make more specified choices in this TUI based configuration tool.
2, sysv-rc – http://packages.debian.org/lenny/sysv-rc
Sysv-rc provides a terminal interface for managing “/etc/rcX.d/” symlinks. With the help of update-rc.d, you can allow turning services on or off simply. Actually it’s much what chkconfig does in Redhat/CentOS, which means you can edit startup scripts for any runlevel.
By default sysv-rc is installed even in a minimal installation. Otherwise you need to run “apt-get install sysv-rc” to install it. Here’re some common usage examples for update-rc.d:
To remove the service SERVICE-NAME:
update-rc.d -f SERVICE-NAME remove
To add the service SERVICE-NAME:
update-rc.d SERVICE-NAME defaults
update-rc.d SERVICE-NAME defaults 29
The argument 29 is optional, which ensures that SERVICE-NAME is called after all scripts whose number is less than 29 have completed, and before all scripts whose number is 30 or greater.
To start the script SERVICE-NAME in runlevels 2345 and stop in 456, run (as root):
update-rc.d SERVICE-NAME start 2 3 4 5 . stop 0 1 6 .
update-rc.d SERVICE-NAME start 30 2 3 4 5 . stop 70 0 1 6 .
You can find more details of this command by running “man 8 update-rc.d”.