NAME¶update-rc.d - install and remove System-V style init script links
SYNOPSIS¶update-rc.d [-n] [-f] name remove
update-rc.d [-n] name defaults [NN | SS KK]
update-rc.d [-n] name start|stop NN runlevel [runlevel]... . start|stop NN runlevel [runlevel]... . ...
update-rc.d [-n] name disable|enable [ S|2|3|4|5 ]
DESCRIPTION¶update-rc.d updates the System V style init script links /etc/rcrunlevel.d/NNname whose target is the script /etc/init.d/name. These links are run by init when it changes runlevels; they are generally used to start and stop system services such as daemons. runlevel is one of the runlevels supported by init, namely, 0123456789S, and NN is the two-digit sequence number that determines where in the sequence init will run the scripts.
INSTALLING INIT SCRIPT LINKS¶update-rc.d has two modes of operation for installing scripts into the boot sequence. A legacy mode where command line arguments are used to decide the sequence and runlevel configuration, and the default mode where dependency and runlevel information in the init.d script LSB comment header is used instead. Such header is required to be present in init.d scripts. See the insserv(8) manual page for details about the LSB header format. The boot sequencing method is decided during installation or upgrades. During upgrades, if there are no loops in the dependencies declared by LSB headers of all installed init.d scripts and no obsolete init.d scripts, the boot system is converted to dependency based boot sequencing. The conversion to dependency based boot sequencing is one-way. The machines using the legacy mode will have a file /etc/init.d/.legacy-bootordering .
REMOVING SCRIPTS¶When invoked with the remove option, update-rc.d removes any links in the /etc/rcrunlevel.d directories to the script /etc/init.d/name. The script must have been deleted already. If the script is still present then update-rc.d aborts with an error message. update-rc.d is usually called from a package's post-removal script when that script is given the purge argument. Any files in the /etc/rcrunlevel.d directories that are not symbolic links to the script /etc/init.d/name will be left untouched.
DISABLING INIT SCRIPT START LINKS¶When run with the disable [ S|2|3|4|5 ] options, update-rc.d modifies existing runlevel links for the script /etc/init.d/name by renaming start links to stop links with a sequence number equal to the difference of 100 minus the original sequence number. When run with the enable [ S|2|3|4|5 ] options, update-rc.d modifies existing runlevel links for the script /etc/init.d/name by renaming stop links to start links with a sequence number equal to the positive difference of current sequence number minus 100, thus returning to the original sequence number that the script had been installed with before disabling it. Both of these options only operate on start runlevel links of S, 2, 3, 4 or 5. If no start runlevel is specified after the disable or enable keywords, the script will attempt to modify links in all start runlevels.
- Don't do anything, just show what we would do.
- Force removal of symlinks even if /etc/init.d/name still exists.
EXAMPLES¶Insert links using the defaults:
update-rc.d foobar defaults The equivalent dependency header would have start and stop dependencies on $remote_fs and $syslog, and start in runlevels 2-5 and stop in runlevels 0, 1 and 6.Equivalent command using explicit argument sets:
update-rc.d foobar start 20 2 3 4 5 . stop 20 0 1 6 .More typical command using explicit argument sets:
update-rc.d foobar start 30 2 3 4 5 . stop 70 0 1 6 .Insert links at default runlevels when B requires A
update-rc.d script_for_A defaults 80 20 update-rc.d script_for_B defaults 90 10Insert a link to a service that (presumably) will not be needed by any other daemon
update-rc.d top_level_app defaults 98 02Insert links for a script that requires services that start/stop at sequence number 20
update-rc.d script_depends_on_svc20 defaults 21 19Remove 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 . stop 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 .
- The directory containing the actual init scripts.
- The directories containing the links used by init and managed by update-rc.d.
- Model for use by writers of init.d scripts.
SEE ALSO¶Debian Policy Manual,
|14 November 2005||Debian Project|