update-rc.d

install and remove System-V style init script links

       update-rc.d [-n] [-f] name remove 
       update-rc.d [-n] name defaults 
       update-rc.d [-n] name disable|enable [ S|2|3|4|5 ]
Updates the init script links /etc/rcrunlevel.d/NNname whose target is the script in /etc/init.d/name. which a run by init when changing runlevels; generally used to start and stop system services such as daemons.

runlevel is one of the runlevels 0123456789S
NN is the sequence number that defines the order the in which the scripts are run.

Dependency and runlevel information is required in the LSB header format.
For example:

### BEGIN INIT INFO
# Provides:     sshd
# Required-Start:   $remote_fs $syslog
# Required-Stop:    $remote_fs $syslog
# Default-Start:    2 3 4 5
# Default-Stop:
# Short-Description:    OpenBSD Secure Shell server
### END INIT INFO

Installing links

By default links are created named /etc/rcrunlevel.d/[SK]NNname

If any files named /etc/ircrunlevel.d/[SK]??name exist nothing is done to prevent changing an existing configuration, which may have been customized

To disable services configure it as stopped in all runlevels By renaming the service's symbolic links from S to K.

Removing links

After removing the script, use update-rd.c to remove links in /etc/rcrunlevel.d

Files in the /etc/rcrunlevel.d directories not symbolic links to the script are untouched.

Disabling / Enabling

disable [ S|2|3|4|5 ] modifies links by renaming start links to stop links with a sequence number of the 100 minus the original sequence number.

enable [ S|2|3|4|5 ] options, modifies links bby renaming stop links to start links restoring the original sequnce number.

If no runlevel is specified all start runlevels are modified.

Options

-n No action is taken, For testing
-f Force removal of links even if script exists.

Examples

Insert links using the defaults:
sudo update-rc.d resize2fs_once defaults && sudo find /etc -name [SsKk]??resize2fs_once -ls
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.

Remove all links for a script : update-rc.d foobar remove
disabling a service: update-rc.d foobar disable
installing initialization-and-shutdown script: update-rc.d foobar defaults
disabling initialization-and-shutdown script: update-rc.d foobar disable

Runlevels

Vary with implementation similar to:

Files

/etc/init.d/ Directory containing scripts.
/etc/rc?.d/ Directories containing the links
Example:
rc0.d AND rc6.d:

 K01alsa-utils ->../init.d/alsa-utils
 K01avahi-daemon ->../init.d/avahi-daemon

 K01bluetooth ->../init.d/bluetooth



 K01dhcpcd ->../init.d/dhcpcd
 K01fake-hwclock ->../init.d/fake-hwclock

 K01grafana-server ->../init.d/grafana-server
 K01hwclock.sh ->../init.d/hwclock.sh
 K01lightdm ->../init.d/lightdm
 K01networking ->../init.d/networking
 K01nfs-common ->../init.d/nfs-common
 K01paxctld ->../init.d/paxctld
 K01plymouth ->../init.d/plymouth
 K01rpcbind ->../init.d/rpcbind



 K01rsyslog ->../init.d/rsyslog

 K01triggerhappy ->../init.d/triggerhappy: 
rc1.d:

 K01alsa-utils -> ../init.d/alsa-utils
 K01avahi-daemon -> ../init.d/avahi-daemon

 K01bluetooth -> ../init.d/bluetooth



 K01dhcpcd -> ../init.d/dhcpcd
 K01fake-hwclock -> ../init.d/fake-hwclock

 K01grafana-server -> ../init.d/grafana-server

 K01lightdm -> ../init.d/lightdm

 K01nfs-common -> ../init.d/nfs-common
 K01paxctld -> ../init.d/paxctld

 K01rpcbind -> ../init.d/rpcbind



 K01rsyslog -> ../init.d/rsyslog

 K01triggerhappy -> ../init.d/triggerhappy

rc2.d AND rc3.d AND rc4.d:
on raspberry pi 
 S01anacron -> ../init.d/anacron

 S01avahi-daemon -> ../init.d/avahi-daemon
 S01binfmt-support -> ../init.d/binfmt-support
 S01bluetooth -> ../init.d/bluetooth
 S01console-setup.sh -> ../init.d/console-setup.sh
 S01cron -> ../init.d/cron
 S01dbus -> ../init.d/dbus
 S01dhcpcd -> ../init.d/dhcpcd

 S01dphys-swapfile -> ../init.d/dphys-swapfile
 S01grafana-server -> ../init.d/grafana-server
 S01lightdm -> ../init.d/lightdm
 


 S01paxctld -> ../init.d/paxctld
 S01plymouth -> ../init.d/plymouth

 S01raspi-config -> ../init.d/raspi-config
 S01rsync -> ../init.d/rsync
 S01rsyslog -> ../init.d/rsyslog
 S01ssh -> ../init.d/ssh
 S01triggerhappy -> ../init.d/triggerhappy
rcS.d 








 K01nfs-common -> ../init.d/nfs-common


 K01rpcbind -> ../init.d/rpcbind
 S01alsa-utils -> ../init.d/alsa-utils
 S01fake-hwclock -> ../init.d/fake-hwclock
 S01hwclock.sh -> ../init.d/hwclock.sh
 S01keyboard-setup.sh -> ../init.d/keyboard-setup.sh
 S01kmod -> ../init.d/kmod
 S01networking -> ../init.d/networking
 S01plymouth-log -> ../init.d/plymouth-log
 S01procps -> ../init.d/procps
 S01raspi-config -> ../init.d/raspi-config
 S01udev -> ../init.d/udev
 S01x11-common -> ../init.d/x11-common

init.d:
alsa-utils
anacron
avahi-daemon
binfmt-support
bluetooth
console-setup.sh
cron
dbus
dhcpcd
dphys-swapfile
fake-hwclock
grafana-server
hwclock.sh
keyboard-setup.sh
kmod
lightdm
networking
nfs-common
paxctld
plymouth
plymouth-log
procps
raspi-config
rpcbind
rsync
rsyslog
ssh
sudo
triggerhappy
udev
x11-common
/etc/init.d/skeleton Model of init.d scripts.

Errors

Starting resize2fs_once (via systemctl): resize2fs_once.serviceWarning:
     resize2fs_once.service changed on disk. Run 'systemctl daemon-reload' to reload units.

SEE ALSO

Debian Policy Manual, /etc/init.d/skeleton, insserv(8), sysv-rc-conf(8), bum(8), init(8).