This manpage documents only the usage and behaviour of update-rc.d. For a discussion of the System V style init script arrangements please see init(8) and the Debian Policy Manual. Please note that this program was designed for use in package maintainer scripts and, accordingly, has only the very limited functionality required by such scripts. System administrators are not encouraged to use update-rc.d to manage runlevels. They should edit the links directly or use runlevel editors such as sysv-rc-conf and bum instead.
If any files /etc/rcrunlevel.d/[SK]??name already exist then update-rc.d does nothing. The program was written this way so that it will never change an existing configuration, which may have been customized by the system administrator. The program will only install links if none are present, i.e., if it appears that the service has never been installed before. 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. 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. If multiuser is used then update-rc.d will make links to start the service in runlevels 2345 and top stop the service in only runlevel 1. By default all the links will have sequence number 20, but this can be overridden by supplying one NN or two SS and KK arguments to either defaults or multiuser; a single argument overrides the sequence number for both start and stop links whereas a pair of arguments overrides the sequence numbers for start and stop links, respectively. As a rule of thumb, the sequence number of the stop link should 100 minus the sequence number of the start link; this causes services to be stopped in the opposite order to that in which they are started. Obviously, therefore, the default stop sequence number should be 80. Defaulting to 20, as update-rc.d does, is an old bug that cannot be fixed because of the risk of breaking things. Instead of defaults or multiuser one can give one or more sets of arguments specifying particular runlevels in which to start or stop the service. Each of these sets of arguments starts with the keyword start or stop and a sequence number NN, followed by one or more runlevel numbers. The set is terminated by a solitary full stop character. When explicit specification, rather than defaults, is used there will usually be one start and one stop set. If different sequence codes are required in different runlevels then several start sets or several stop sets may be specified. If this is done and the same runlevel is named in multiple sets then only the last one counts. Therefore it is not possible to create multiple start or multiple stop links for a service in a single runlevel directory. The script /etc/init.d/name must exist before update-rc.d is run to create the links.
update-rc.d foobar defaultsEquivalent command using explicit argument sets:
update-rc.d foobar start 20 2 3 4 5 . stop 20 0 1 6 .Insert links for a service that should be running during multi-user mode, but that does not need to be explicitly stopped on shutdown:
update-rc.d foobar multiuserEquivalent command using explicit argument sets:
update-rc.d foobar start 20 2 3 4 5 . stop 20 1 .More typical command using explicit argument sets:
update-rc.d foobar start 30 2 3 4 5 . stop 70 0 1 6 .Remove all links for a script (assuming foobar has been deleted already):
update-rc.d foobar removeExample of disabling a service:
update-rc.d -f foobar remove update-rc.d foobar stop 20 2 3 4 5 .Example of a command for installing a system initialization-and-shutdown script:
update-rc.d foobar start 45 S . start 31 0 6 .Example of a command for disabling a system initialization-and-shutdown script:
update-rc.d -f foobar remove update-rc.d foobar stop 45 S .
Unless your init script does something in the stop command that is more than just sending the TERM or KILL signal to the running process, you should strongly consider using multiuser instead of defaults.