| 1 |
=================== |
| 2 |
update-rc.d |
| 3 |
=================== |
| 4 |
|
| 5 |
--------------------------------------------------------- |
| 6 |
install and remove System-V style init script links |
| 7 |
--------------------------------------------------------- |
| 8 |
|
| 9 |
:Manual section: 8 |
| 10 |
:Manual group: Debian GNU/Linux |
| 11 |
:Author: |
| 12 |
Ian Jackson, |
| 13 |
Miquel van Smoorenburg |
| 14 |
|
| 15 |
:Version: 14 November 2005 |
| 16 |
:Copyright: 2001 Henrique de Moraes Holschuh |
| 17 |
:License: GNU General Public License v2 or Later (GPLv2+) |
| 18 |
|
| 19 |
|
| 20 |
SYNOPSIS |
| 21 |
========= |
| 22 |
|
| 23 |
``update-rc.d`` [*-f*] *name* ``remove`` |
| 24 |
|
| 25 |
``update-rc.d`` *name* ``defaults`` |
| 26 |
|
| 27 |
``update-rc.d`` *name* ``defaults-disabled`` |
| 28 |
|
| 29 |
``update-rc.d`` *name* ``disable|enable`` [ *S|2|3|4|5* ] |
| 30 |
|
| 31 |
|
| 32 |
DESCRIPTION |
| 33 |
=========== |
| 34 |
|
| 35 |
``update-rc.d`` updates the System V style init script links |
| 36 |
``/etc/rc``\ *runlevel*\ ``.d/``\ *NNname* |
| 37 |
whose target is the script |
| 38 |
``/etc/init.d/``\ *name*. |
| 39 |
These links are run by |
| 40 |
``init`` |
| 41 |
when it changes runlevels; they are generally used to start and stop |
| 42 |
system services such as daemons. |
| 43 |
*runlevel* |
| 44 |
is one of the runlevels supported by |
| 45 |
``init``, namely, ``0123456789S``, and |
| 46 |
*NN* |
| 47 |
is the two-digit sequence number that determines where in the sequence |
| 48 |
``init`` |
| 49 |
will run the scripts. |
| 50 |
|
| 51 |
This manpage documents only the usage and behaviour of |
| 52 |
``update-rc.d``. |
| 53 |
For a discussion of the System V style init script arrangements please |
| 54 |
see |
| 55 |
``init``\(8) |
| 56 |
and the |
| 57 |
*Debian Policy Manual*. |
| 58 |
|
| 59 |
|
| 60 |
INSTALLING INIT SCRIPT LINKS |
| 61 |
============================ |
| 62 |
|
| 63 |
update-rc.d requires dependency and runlevel information to be |
| 64 |
provided in the init.d script LSB comment header of all init.d scripts. |
| 65 |
See the insserv(8) manual page for details about the LSB header format. |
| 66 |
|
| 67 |
When run with the |
| 68 |
``defaults`` |
| 69 |
option, |
| 70 |
``update-rc.d`` |
| 71 |
makes links named |
| 72 |
``/etc/rc``\ *runlevel*\ ``.d/[SK]``\ *NNname* |
| 73 |
that point to the script |
| 74 |
``/etc/init.d/``\ *name*, |
| 75 |
using runlevel and dependency information from the init.d script LSB |
| 76 |
comment header. |
| 77 |
|
| 78 |
When run with the |
| 79 |
``defaults-disabled`` |
| 80 |
option, |
| 81 |
``update-rc.d`` |
| 82 |
makes links named |
| 83 |
``/etc/rc``\ *runlevel*\ ``.d/K``\ *NNname* |
| 84 |
that point to the script |
| 85 |
``/etc/init.d/``\ *name*, |
| 86 |
using dependency information from the init.d script LSB comment header. |
| 87 |
This means that the init.d script will be disabled (see below). |
| 88 |
|
| 89 |
If any files named |
| 90 |
``/etc/rc``\ *runlevel*\ ``.d/[SK]??``\ *name* |
| 91 |
already exist then |
| 92 |
``update-rc.d`` |
| 93 |
does nothing. |
| 94 |
The program was written this way so that it will never |
| 95 |
change an existing configuration, which may have been |
| 96 |
customized by the system administrator. |
| 97 |
The program will only install links if none are present, |
| 98 |
i.e., |
| 99 |
if it appears that the service has never been installed before. |
| 100 |
|
| 101 |
Older versions of |
| 102 |
``update-rc.d`` |
| 103 |
also supported |
| 104 |
``start`` |
| 105 |
and |
| 106 |
``stop`` |
| 107 |
options. These options are no longer supported, and are now |
| 108 |
equivalent to the |
| 109 |
``defaults`` |
| 110 |
option. |
| 111 |
|
| 112 |
A common system administration error is to delete the links |
| 113 |
with the thought that this will "disable" the service, i.e., |
| 114 |
that this will prevent the service from being started. |
| 115 |
However, if all links have been deleted then the next time |
| 116 |
the package is upgraded, the package's |
| 117 |
*postinst* |
| 118 |
script will run |
| 119 |
``update-rc.d`` |
| 120 |
again and this will reinstall links at their factory default locations. |
| 121 |
The correct way to disable services is to configure the |
| 122 |
service as stopped in all runlevels in which it is started by default. |
| 123 |
In the System V init system this means renaming |
| 124 |
the service's symbolic links |
| 125 |
from ``S`` to ``K``. |
| 126 |
.P |
| 127 |
The script |
| 128 |
.BI /etc/init.d/ name |
| 129 |
must exist before |
| 130 |
``update-rc.d`` |
| 131 |
is run to create the links. |
| 132 |
|
| 133 |
REMOVING SCRIPTS |
| 134 |
================ |
| 135 |
|
| 136 |
When invoked with the |
| 137 |
*remove* |
| 138 |
option, update-rc.d removes any links in the |
| 139 |
``/etc/rc``\ *runlevel*\ ``.d`` |
| 140 |
directories to the script |
| 141 |
``/etc/init.d/``\ *name*. |
| 142 |
The script must have been deleted already. |
| 143 |
If the script is still present then |
| 144 |
``update-rc.d`` |
| 145 |
aborts with an error message. |
| 146 |
.P |
| 147 |
``update-rc.d`` |
| 148 |
is usually called from a package's post-removal script when that |
| 149 |
script is given the |
| 150 |
``purge`` |
| 151 |
argument. |
| 152 |
Any files in the |
| 153 |
``/etc/rc``\ *runlevel*\ ``.d`` |
| 154 |
directories that are not symbolic links to the script |
| 155 |
``/etc/init.d/``\ *name* |
| 156 |
will be left untouched. |
| 157 |
|
| 158 |
DISABLING INIT SCRIPT START LINKS |
| 159 |
================================= |
| 160 |
|
| 161 |
When run with the |
| 162 |
``disable`` [ *S|2|3|4|5* ] |
| 163 |
options, |
| 164 |
``update-rc.d`` |
| 165 |
modifies existing runlevel links for the script |
| 166 |
``/etc/init.d/``\ *name* |
| 167 |
by renaming start links to stop links with a sequence number equal |
| 168 |
to the difference of 100 minus the original sequence number. |
| 169 |
|
| 170 |
When run with the |
| 171 |
``enable`` [ *S|2|3|4|5* ] |
| 172 |
options, |
| 173 |
``update-rc.d`` |
| 174 |
modifies existing runlevel links for the script |
| 175 |
``/etc/init.d/``\ *name* |
| 176 |
by renaming stop links to start links with a sequence number equal |
| 177 |
to the positive difference of current sequence number minus 100, thus |
| 178 |
returning to the original sequence number that the script had been |
| 179 |
installed with before disabling it. |
| 180 |
.P |
| 181 |
Both of these options only operate on start runlevel links of S, 2, |
| 182 |
3, 4 or 5. If no start runlevel is specified after the disable or enable |
| 183 |
keywords, the script will attempt to modify links in all start runlevels. |
| 184 |
|
| 185 |
|
| 186 |
OPTIONS |
| 187 |
======= |
| 188 |
|
| 189 |
-f |
| 190 |
Force removal of symlinks even if |
| 191 |
``/etc/init.d/``\ *name* |
| 192 |
still exists. |
| 193 |
|
| 194 |
EXAMPLES |
| 195 |
======== |
| 196 |
|
| 197 |
Insert links using the defaults: |
| 198 |
|
| 199 |
``update-rc.d foobar defaults`` |
| 200 |
|
| 201 |
The equivalent dependency header would have start and stop |
| 202 |
dependencies on $remote_fs and $syslog, and start in |
| 203 |
runlevels 2-5 and stop in runlevels 0, 1 and 6. |
| 204 |
|
| 205 |
|
| 206 |
Remove all links for a script (assuming foobar has been deleted |
| 207 |
already): |
| 208 |
|
| 209 |
``update-rc.d foobar remove`` |
| 210 |
|
| 211 |
Example of disabling a service: |
| 212 |
|
| 213 |
``update-rc.d foobar disable`` |
| 214 |
|
| 215 |
Example of a command for installing a system initialization-and-shutdown script: |
| 216 |
|
| 217 |
``update-rc.d foobar defaults`` |
| 218 |
|
| 219 |
Example of a command for disabling a system initialization-and-shutdown script: |
| 220 |
|
| 221 |
``update-rc.d foobar disable`` |
| 222 |
|
| 223 |
BUGS |
| 224 |
==== |
| 225 |
|
| 226 |
See http://bugs.debian.org/sysv-rc and |
| 227 |
http://bugs.debian.org/init-system-helpers. |
| 228 |
|
| 229 |
FILES |
| 230 |
===== |
| 231 |
|
| 232 |
|
| 233 |
``/etc/init.d/`` |
| 234 |
The directory containing the actual init scripts. |
| 235 |
|
| 236 |
``/etc/rc?.d/`` |
| 237 |
The directories containing the links used by ``init`` |
| 238 |
and managed by ``update-rc.d .`` |
| 239 |
|
| 240 |
``/etc/init.d/skeleton`` |
| 241 |
Model for use by writers of ``init.d`` scripts. |
| 242 |
|
| 243 |
SEE ALSO |
| 244 |
======== |
| 245 |
|
| 246 |
| *Debian Policy Manual*, |
| 247 |
| ``/etc/init.d/skeleton``, |
| 248 |
| ``insserv``\(8), |
| 249 |
| ``init``\(8) |