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 |
/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.
/etc/rcrunlevel.d
Files in the /etc/rcrunlevel.d directories not symbolic links to the script are untouched.
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.
-n
No action is taken, For testing -f
Force removal of links even if script exists.
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
/etc/init.d/
Directory containing scripts./etc/rc?.d/
Directories containing the links 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 |
/etc/init.d/skeleton
Model of init.d scripts.