summaryrefslogtreecommitdiffstats
path: root/man8/update-rc.d.rst
blob: b1da14eb40245976cf7d14007a267d4b87bc3226 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
===================
 update-rc.d
===================

---------------------------------------------------------
install and remove System-V style init script links
---------------------------------------------------------

:Manual section: 8
:Manual group: Debian GNU/Linux
:Author:
    Ian Jackson,
    Miquel van Smoorenburg

:Version:   14 November 2005
:Copyright: 2001 Henrique de Moraes Holschuh
:License:   GNU General Public License v2 or Later (GPLv2+)


SYNOPSIS
=========

``update-rc.d`` [*-f*] *name* ``remove``

``update-rc.d`` *name* ``defaults``

``update-rc.d`` *name* ``defaults-disabled``

``update-rc.d`` *name* ``disable|enable`` [ *S|2|3|4|5* ]


DESCRIPTION
===========

``update-rc.d`` updates the System V style init script links
``/etc/rc``\ *runlevel*\ ``.d/``\ *NNname*
whose target is the script
``/etc/init.d/``\ *name*.
These links are run by
``init``
when it changes runlevels; they are generally used to start and stop
system services such as daemons.
*runlevel*
is one of the runlevels supported by
``init``, namely, ``0123456789S``, and
*NN*
is the two-digit sequence number that determines where in the sequence
``init``
will run the scripts.

This manpage documents only the usage and behaviour of
``update-rc.d``.
For a discussion of the System V style init script arrangements please
see
``init``\(8)
and the
*Debian Policy Manual*.


INSTALLING INIT SCRIPT LINKS
============================

update-rc.d requires dependency and runlevel information to be
provided in the init.d script LSB comment header of all init.d scripts.
See the insserv(8) manual page for details about the LSB header format.

When run with the
``defaults``
option,
``update-rc.d``
makes links named
``/etc/rc``\ *runlevel*\ ``.d/[SK]``\ *NNname*
that point to the script
``/etc/init.d/``\ *name*,
using runlevel and dependency information from the init.d script LSB
comment header.

When run with the
``defaults-disabled``
option,
``update-rc.d``
makes links named
``/etc/rc``\ *runlevel*\ ``.d/K``\ *NNname*
that point to the script
``/etc/init.d/``\ *name*,
using dependency information from the init.d script LSB comment header.
This means that the init.d script will be disabled (see below).

If any files named
``/etc/rc``\ *runlevel*\ ``.d/[SK]??``\ *name*
already exist then
``update-rc.d``
does nothing.
The program was written this way so that it will never
change an existing configuration, which may have been
customized by the system administrator.
The program will only install links if none are present,
i.e.,
if it appears that the service has never been installed before.

Older versions of
``update-rc.d``
also supported
``start``
and
``stop``
options.  These options are no longer supported, and are now
equivalent to the
``defaults``
option.

A common system administration error is to delete the links
with the thought that this will "disable" the service, i.e.,
that this will prevent the service from being started.
However, if all links have been deleted then the next time
the package is upgraded, the package's
*postinst*
script will run
``update-rc.d``
again and this will reinstall links at their factory default locations.
The correct way to disable services is to configure the
service as stopped in all runlevels in which it is started by default.
In the System V init system this means renaming
the service's symbolic links
from ``S`` to ``K``.
.P
The script
.BI /etc/init.d/ name
must exist before
``update-rc.d``
is run to create the links.

REMOVING SCRIPTS
================

When invoked with the
*remove*
option, update-rc.d removes any links in the
``/etc/rc``\ *runlevel*\ ``.d``
directories to the script
``/etc/init.d/``\ *name*.
The script must have been deleted already.
If the script is still present then
``update-rc.d``
aborts with an error message.
.P
``update-rc.d``
is usually called from a package's post-removal script when that
script is given the
``purge``
argument.
Any files in the
``/etc/rc``\ *runlevel*\ ``.d``
directories that are not symbolic links to the script
``/etc/init.d/``\ *name*
will be left untouched.

DISABLING INIT SCRIPT START LINKS
=================================

When run with the
``disable`` [ *S|2|3|4|5* ]
options,
``update-rc.d``
modifies existing runlevel links for the script
``/etc/init.d/``\ *name*
by renaming start links to stop links with a sequence number equal
to the difference of 100 minus the original sequence number.

When run with the
``enable`` [ *S|2|3|4|5* ]
options,
``update-rc.d``
modifies existing runlevel links for the script
``/etc/init.d/``\ *name*
by renaming stop links to start links with a sequence number equal
to the positive difference of current sequence number minus 100, thus
returning to the original sequence number that the script had been
installed with before disabling it.
.P
Both of these options only operate on start runlevel links of S, 2,
3, 4 or 5. If no start runlevel is specified after the disable or enable
keywords, the script will attempt to modify links in all start runlevels.


OPTIONS
=======

-f
    Force removal of symlinks even if
    ``/etc/init.d/``\ *name*
    still exists.

EXAMPLES
========

Insert links using the defaults:

    ``update-rc.d foobar defaults``

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 (assuming foobar has been deleted
already):

    ``update-rc.d foobar remove``

Example of disabling a service:

    ``update-rc.d foobar disable``

Example of a command for installing a system initialization-and-shutdown script:

    ``update-rc.d foobar defaults``

Example of a command for disabling a system initialization-and-shutdown script:

    ``update-rc.d foobar disable``

BUGS
====

See http://bugs.debian.org/sysv-rc and
http://bugs.debian.org/init-system-helpers.

FILES
=====


``/etc/init.d/``
    The directory containing the actual init scripts.

``/etc/rc?.d/``
    The directories containing the links used by ``init``
    and managed by ``update-rc.d .``

``/etc/init.d/skeleton``
    Model for use by writers of ``init.d`` scripts.

SEE ALSO
========

| *Debian Policy Manual*,
| ``/etc/init.d/skeleton``,
| ``insserv``\(8),
| ``init``\(8)