update-rc.d
was initially used by package upgrade scripts. remove
is called on package uninstall and removes all links, defaults
is called on package install, enable
or disable
might be used depending on debconf and are useful to sysadmins. The cleanups remove
does are not in fact useful to disable a service. From the man page:
A common system administration error is to delete the links with the
thought that this will "disable" the service, i.e., that this will prevent
the service from being started. However, if all links have been
deleted then the next time the package is upgraded, the package's
postinst script will run update-rc.d again and this will reinstall
links at their factory default locations. The correct way to disable
services is to configure the service as stopped in all runlevels in
which it is started by default. In the System V init system this means
renaming the service's symbolic links from S to K.
sudo update-rc.d postgresql disable
will do what you want, because it keeps the rc.d symlinks but with the K (killed, stopped) prefix. Revert it with an enable
. Some services support being disabled from their /etc/defaults/$service
file, but sadly there are exceptions. Other ways to disable a service are to chmod -x the /etc/init.d/$service
file, or to insert an exit 0
at the top of it.
file-rc
. Instead of managing symlinks, I manage a text file with my runlevel configurations.