~ubuntu-branches/debian/experimental/sysvinit/experimental

« back to all changes in this revision

Viewing changes to debian/sysv-rc/man8/update-rc.d.8

  • Committer: Bazaar Package Importer
  • Author(s): Petter Reinholdtsen
  • Date: 2008-08-12 16:07:50 UTC
  • Revision ID: james.westby@ubuntu.com-20080812160750-65gpyv74vh4qr69w
Tags: 2.86.ds1-61
* Fix typo in rcS(5), proberly->properly (Closes: #484233).  Thanks to
  Julien Danjou for noticing.
* Fix typo in rcS(5), maually->manually (Closes: #493680).  Thanks to
  Xr for noticing.
* Modify runlevel detection code in invoke-rc.d to notice the
  difference between runlevels 0 and 6, and the boot runlevel, to
  make it possible to use invoke-rc.d during boot (Closes: 384509).
* Make sure to call restorecon after mounting tmpfs file systems, to
  set SELinux permissions (Closes: #493679).  Patch from Russell
  Coker.
* Move responsibility of stopping the splash screen process from
  individual init.d scripts to init.d/rc.  This make sure the
  progress calculation reflect reality, and that the splash screen
  is taken down in runlevel 1 (Closes: #431560) and that it stop
  before gdm and kdm (Closes: #422922, #489734).
* Skip error message from checkfs.sh when / is read-only.  Patch
  from Mirek Slugen (Closes: #492214).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
.\" Hey, Emacs!  This is an -*- nroff -*- source file.
2
2
.\" Authors: Ian Jackson, Miquel van Smoorenburg
3
 
.TH UPDATE\-RC.D 8 "23 December 2003" "Debian Project" "sysv-rc"
 
3
.TH UPDATE\-RC.D 8 "14 November 2005" "Debian Project" "sysv-rc"
4
4
.SH NAME
5
5
update\-rc.d \- install and remove System-V style init script links
6
6
.SH SYNOPSIS
12
12
.B update-rc.d
13
13
.RI [ -n ]
14
14
.IB name " defaults"
15
 
.RI [ NN " | " NN-start " " NN-stop ]
 
15
.RI [ NN " | " SS " " KK ]
16
16
.HP
17
17
.B update-rc.d
18
18
.RI [ -n ]
19
19
.I name
20
20
.BR start | stop
21
 
.IR "NN runlevel runlevel " ...
 
21
.IR "NN runlevel" " [" runlevel "]..."
22
22
.B .
23
23
.BR start | stop
24
 
.IR "NN runlevel runlevel " ...
 
24
.IR "NN runlevel" " [" runlevel "]..."
25
25
.BR . " ..."
26
26
.SH DESCRIPTION
27
27
.B update-rc.d
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
 
to scripts
 
30
whose target is the script
31
31
.BI /etc/init.d/ name \fR.
32
 
These are run by
 
32
These links are run by
33
33
.B init
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.
36
36
.I runlevel
37
37
is one of the runlevels supported by
38
 
.BR init ", " 0123456789S ,
39
 
and
 
38
.BR init ", namely, " 0123456789S ", and "
40
39
.I NN
41
 
is the two-digit sequence code used by
 
40
is the two-digit sequence number that determines where in the sequence
42
41
.B init
43
 
to decide which order to run the scripts in.
 
42
will run the scripts.
44
43
 
45
44
This manpage documents only the usage and behaviour of
46
45
.BR update-rc.d .
49
48
.BR init (8)
50
49
and the
51
50
.IR "Debian Policy Manual" .
 
51
.P
 
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
 
56
.BR update-rc.d
 
57
to manage runlevels.
 
58
They should edit the links directly or
 
59
use runlevel editors such as
 
60
.B sysv-rc-conf
 
61
and
 
62
.B bum
 
63
instead.
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
 
67
options,
 
68
.B update-rc.d
 
69
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.
59
73
 
60
74
If any files
61
75
.BI /etc/rc runlevel .d/[SK]?? name
62
76
already exist then
63
77
.B update-rc.d
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.
67
 
 
 
78
does nothing.
 
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,
 
83
i.e.,
 
84
if it appears that the service has never been installed before.
 
85
.P
 
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
 
91
.I postinst
 
92
script will run
 
93
.B update-rc.d
 
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
 
99
from
 
100
.B S
 
101
to
 
102
.BR K .
 
103
.P
68
104
If
69
105
.B defaults
70
106
is used then
71
107
.B update-rc.d
72
108
will make links to start the service in runlevels
73
109
.B 2345
74
 
and stop the service in runlevels
 
110
and to stop the service in runlevels
75
111
.BR 016 .
76
 
By default all the links will have sequence code 20, but
77
 
this can be overridden by supplying one or two
78
 
.I NN
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.
82
 
 
 
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.
 
118
.P
 
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.
 
124
.P
 
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
 
130
vice-versa.
 
131
.P
 
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
 
137
should be 80.
 
138
Defaulting to 20, as
 
139
.B update-rc.d
 
140
does, is an old bug that cannot be fixed because
 
141
of the risk of breaking things.
 
142
.P
83
143
Instead of
84
144
.B defaults
85
 
the runlevels in which to start and stop the service may be specified
86
 
explicitly using a series of sets of arguments:
87
 
 
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.
91
 
Then follows
 
149
and a sequence number
92
150
.IR NN ,
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
95
 
an argument
96
 
.B .
97
 
(a single full stop).
98
 
 
 
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
100
154
.BR defaults ,
101
155
is used there will usually be one
108
162
sets or several
109
163
.B stop
110
164
sets may be specified.
111
 
 
 
165
If this is done and the same runlevel is named in multiple sets
 
166
then only the last one counts.
 
167
Therefore it is not possible to create multiple
 
168
.B start
 
169
or multiple
 
170
.B stop
 
171
links for a service in a single runlevel directory.
 
172
.P
112
173
The script
113
174
.BI /etc/init.d/ name
114
175
must exist before
121
182
.BI /etc/rc runlevel .d
122
183
directories to the script
123
184
.BI /etc/init.d/ name\fR.
124
 
The script must have been deleted already -
 
185
The script must have been deleted already.
 
186
If the script is still present then
125
187
.B update-rc.d
126
 
checks for this.
 
188
aborts with an error message.
 
189
.P
127
190
.B update-rc.d
128
191
is usually called from a package's post-removal script when that
129
 
script detects that its first argument is
130
 
.BR purge ,
131
 
indicating that the user has requested the configuration for the
132
 
package to be removed.
 
192
script is given the
 
193
.B purge
 
194
argument.
133
195
Any files in the
134
196
.BI /etc/rc runlevel .d
135
197
directories that are not symbolic links to the script
136
198
.BI /etc/init.d/ name
137
199
will be left untouched.
 
200
 
138
201
.SH OPTIONS
139
202
.TP
140
203
.I -n
153
216
.nf
154
217
.B "   update-rc.d foobar start 20 2 3 4 5 . stop 20 0 1 6 ."
155
218
.fi
 
219
More typical command using explicit argument sets:
 
220
.nf
 
221
.B "   update-rc.d foobar start 30 2 3 4 5 . stop 70 0 1 6 ."
 
222
.fi
 
223
Insert links at default runlevels when B requires A
 
224
.nf
 
225
.B "   update-rc.d script_for_A defaults 80 20"
 
226
.B "   update-rc.d script_for_B defaults 90 10"
 
227
.fi
 
228
Insert a link to a service that (presumably) will not be
 
229
needed by any other daemon
 
230
.nf
 
231
.B "   update-rc.d top_level_app defaults 98 02"
 
232
.fi
 
233
Insert links for a script that requires services that
 
234
start/stop at sequence number 20
 
235
.nf
 
236
.B "   update-rc.d script_depends_on_svc20 defaults 21 19"
 
237
.fi
 
238
Remove all links for a script (assuming foobar has been deleted
 
239
already):
 
240
.nf
 
241
.B "   update-rc.d foobar remove"
 
242
.fi
 
243
Example of disabling a service:
 
244
.nf
 
245
.B "   update-rc.d -f foobar remove"
 
246
.B "   update-rc.d foobar stop 20 2 3 4 5 ."
 
247
.fi
 
248
Example of a command for installing a system initialization-and-shutdown script:
 
249
.nf
 
250
.B "   update-rc.d foobar start 45 S . stop 31 0 6 ."
 
251
.fi
 
252
Example of a command for disabling a system initialization-and-shutdown script:
 
253
.nf
 
254
.B "   update-rc.d -f foobar remove"
 
255
.B "   update-rc.d foobar stop 45 S ."
 
256
.fi
 
257
 
156
258
.SH BUGS
157
 
 
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
160
 
.B defaults
161
 
and possibly to override other things as well.
 
259
See http://bugs.debian.org/sysv-rc.
162
260
.SH FILES
163
261
.TP
164
262
.B /etc/init.d/
179
277
.br
180
278
.BR /etc/init.d/skeleton ,
181
279
.br
 
280
.BR sysv-rc-conf (8),
 
281
.BR bum (8),
182
282
.BR init (8).