5333 private links
Linux services can be started, stopped and reloaded with the use of scripts stocked in /etc/init.d/.
However, during start up or when changing runlevel, those scripts are searched in /etc/rcX.d/ where X is the runlevel number.
The advantage of using update-rc.d is that it will take care of removing/adding any required links to /etc/init.d automatically.
Taking apache2 as an example, let’s examine how /etc/rcX.d is looking like:
ls -l /etc/rc?.d/*apache2
As you can see, for runlevels 0, 1 and 6 there is a K at the beginning of the link, for runlevels 2, 3, 4 and 5, there is a S. Those two letters stands for Kill and Start.
On Debian and Ubuntu, runlevels 2, 3, 4 and 5 are multi-users runlevels.
-
Runlevel 0 is Halt.
-
Runlevel 1 is single user mode
-
Runlevel 6 is reboot
#Removing a Service
update-rc.d -f apache2 remove
The use of -f is to force the removal of the symlinks even if there is still /etc/init.d/apache2.
Now, if you want to re-add this service to be started on boot up, you can simply use:
update-rc.d apache2 defaults