14
14
.IB name " defaults"
15
.RI [ NN " | " NN-start " " NN-stop ]
15
.RI [ NN " | " SS " " KK ]
21
.IR "NN runlevel runlevel " ...
21
.IR "NN runlevel" " [" runlevel "]..."
24
.IR "NN runlevel runlevel " ...
24
.IR "NN runlevel" " [" runlevel "]..."
28
automatically updates the System V style init script links
28
updates the System V style init script links
29
29
.BI /etc/rc runlevel .d/ NNname
30
whose target is the script
31
31
.BI /etc/init.d/ name \fR.
32
These links are run by
34
when changing runlevels and are generally used to start and stop
34
when it changes runlevels; they are generally used to start and stop
35
35
system services such as daemons.
37
37
is one of the runlevels supported by
38
.BR init ", " 0123456789S ,
38
.BR init ", namely, " 0123456789S ", and "
41
is the two-digit sequence code used by
40
is the two-digit sequence number that determines where in the sequence
43
to decide which order to run the scripts in.
45
44
This manpage documents only the usage and behaviour of
51
50
.IR "Debian Policy Manual" .
52
Please note that this program was designed for use
53
in package maintainer scripts and, accordingly,
54
has only the very limited functionality required by such scripts.
55
System administrators are not encouraged to use
58
They should edit the links directly or
59
use runlevel editors such as
52
64
.SH INSTALLING INIT SCRIPT LINKS
53
65
When run with either the
54
66
.BR defaults ", " start ", or " stop
55
options, update-rc.d makes links
56
70
.BI /etc/rc runlevel .d/[SK] NNname
57
pointing to the script
58
.BI /etc/init.d/ name\fR,
71
that point to the script
72
.BR /etc/init.d/ \fIname\fR.
61
75
.BI /etc/rc runlevel .d/[SK]?? name
64
does nothing. This is so that the system administrator can rearrange
65
the links, provided that they leave at least one link remaining,
66
without having their configuration overwritten.
79
The program was written this way so that it will never
80
change an existing configuration, which may have been
81
customized by the system administrator.
82
The program will only install links if none are present,
84
if it appears that the service has never been installed before.
86
A common system administration error is to delete the links
87
with the thought that this will "disable" the service, i.e.,
88
that this will prevent the service from being started.
89
However, if all links have been deleted then the next time
90
the package is upgraded, the package's
94
again and this will reinstall links at their factory default locations.
95
The correct way to disable services is to configure the
96
service as stopped in all runlevels in which it is started by default.
97
In the System V init system this means renaming
98
the service's symbolic links
72
108
will make links to start the service in runlevels
74
and stop the service in runlevels
110
and to stop the service in runlevels
76
By default all the links will have sequence code 20, but
77
this can be overridden by supplying one or two
79
arguments; one argument overrides the sequence code for both start and
80
stop links whereas of two arguments the first overrides the code for
81
start links and the second that for stop links.
112
By default all the links will have sequence number 20, but
113
this should be overridden if there are dependencies. For example if
114
daemon B depends on A, then A must be started before B and B must be
115
killed before A. You accomplish this by supplying two NN arguments. In
116
general, core daemons should start early and be killed late, whilst
117
applications can start late and be killed early. See EXAMPLES below.
119
The first NN argument supplies the start sequence number and
120
the second NN argument supplies the kill sequence number.
121
Kill scripts are called first, passing a stop argument. Then
122
start scripts are called passing a start argument. In either
123
case, calls happen in ascending sequence number order.
125
Supplying a single NN argument will use the same number for
126
both start and kill links. This is supported for backward
127
compatibility but is discouraged, as it may lead to inconsistent
128
settings. As a rule of thumb, if you increase the start sequence
129
number you should also decrease the stop sequence number, and
132
As a rule of thumb, the sequence number of the stop link
133
should be 100 minus the sequence number of the start link;
134
this causes services to be stopped in the opposite order
135
to that in which they are started.
136
Obviously, therefore, the default stop sequence number
140
does, is an old bug that cannot be fixed because
141
of the risk of breaking things.
85
the runlevels in which to start and stop the service may be specified
86
explicitly using a series of sets of arguments:
88
Each of these sets starts with an argument
145
one can give one or more sets of arguments specifying
146
particular runlevels in which to start or stop the service.
147
Each of these sets of arguments starts with the keyword
89
148
.BR start " or " stop
90
to specify whether start or stop links are to be created by that set.
149
and a sequence number
93
the sequence code number for all the links in the set, and one or more
94
runlevel numbers as a single argument each. The set is terminated by
151
followed by one or more runlevel numbers.
152
The set is terminated by a solitary full stop character.
99
153
When explicit specification, rather than
101
155
is used there will usually be one
154
217
.B " update-rc.d foobar start 20 2 3 4 5 . stop 20 0 1 6 ."
219
More typical command using explicit argument sets:
221
.B " update-rc.d foobar start 30 2 3 4 5 . stop 70 0 1 6 ."
223
Insert links at default runlevels when B requires A
225
.B " update-rc.d script_for_A defaults 80 20"
226
.B " update-rc.d script_for_B defaults 90 10"
228
Insert a link to a service that (presumably) will not be
229
needed by any other daemon
231
.B " update-rc.d top_level_app defaults 98 02"
233
Insert links for a script that requires services that
234
start/stop at sequence number 20
236
.B " update-rc.d script_depends_on_svc20 defaults 21 19"
238
Remove all links for a script (assuming foobar has been deleted
241
.B " update-rc.d foobar remove"
243
Example of disabling a service:
245
.B " update-rc.d -f foobar remove"
246
.B " update-rc.d foobar stop 20 2 3 4 5 ."
248
Example of a command for installing a system initialization-and-shutdown script:
250
.B " update-rc.d foobar start 45 S . stop 31 0 6 ."
252
Example of a command for disabling a system initialization-and-shutdown script:
254
.B " update-rc.d -f foobar remove"
255
.B " update-rc.d foobar stop 45 S ."
158
There should be a way for the system administrator to specify at least
159
the default start and stop runlevels to be used by
161
and possibly to override other things as well.
259
See http://bugs.debian.org/sysv-rc.