Debian Codegraph @

man8/invoke-rc.d.rst

raw
1 ===================
2 invoke-rc.d
3 ===================
4
5 ---------------------------------------------------------
6 executes System-V style init script actions
7 ---------------------------------------------------------
8
9 :Manual section: 8
10 :Manual group: Debian GNU/Linux
11 :Author:
12 Henrique de Moraes Holschuh
13
14 :Version: 1 March 2001
15 :Copyright: 2001 Henrique de Moraes Holschuh
16 :License: GNU General Public License v2 or Later (GPLv2+)
17
18 SYNOPSIS
19 ========
20
21 ``invoke-rc.d`` [*--quiet*] [*--force*] [*--try-anyway*] [*--disclose-deny*]
22 [*--query*] [*--no-fallback*] *name* *action* [*init script parameters...*]
23
24
25 ``invoke-rc.d`` [*--help*]
26
27 DESCRIPTION
28 ===========
29
30 ``invoke-rc.d``
31 is a generic interface to execute System V style init script
32 ``/etc/init.d/``\ *name*
33 actions, obeying runlevel constraints as well as any local
34 policies set by the system administrator.
35
36 All access to the init scripts by Debian packages' maintainer
37 scripts should be done through
38 ``invoke-rc.d``.
39
40 This manpage documents only the usage and behavior of
41 ``invoke-rc.d``.
42 For a discussion of the System V style init script arrangements please
43 see ``init``\(8\).
44 More information on invoke-rc.d can be found in the section on
45 runlevels and init.d scripts of the
46 *Debian Policy Manual*.
47
48
49 INIT SCRIPT ACTIONS
50 ===================
51
52 The standard actions are:
53 *start*, *stop*, *force-stop*, *restart*, *try-restart*, *reload*,
54 *force-reload*, and *status*.
55 Other actions are accepted, but they can cause problems to
56 ``policy-rc.d`` (see the ``INIT SCRIPT POLICY`` section), so
57 warnings are generated if the policy layer is active.
58
59 Please note that not all init scripts will implement all
60 the actions listed above, and that the policy layer may
61 override an action to another action(s), or even deny it.
62
63 Any extra parameters will be passed to the init script(s) being
64 executed.
65
66 If an action must be carried out regardless of any local
67 policies, use the *--force* switch.
68
69 OPTIONS
70 =======
71
72 *--help*
73 Display usage help.
74
75 *--quiet*
76 Quiet mode, no error messages are generated.
77
78 *--force*
79 Tries to run the init script regardless of policy and
80 init script subsystem errors.
81 **Use of this option in Debian maintainer scripts is severely discouraged.**
82
83 *--try-anyway*
84 Tries to run the init script if a non-fatal error is
85 detected.
86
87 *--disclose-deny*
88 Return status code 101 instead of status code 0 if
89 the init script action is denied by the policy layer.
90
91 *--query*
92 Returns one of the status codes 100-106. Does not
93 run the init script, and implies *--disclose-deny*
94 and *--no-fallback*.
95
96 *--no-fallback*
97 Ignores any fallback action requests by the policy
98 layer.
99 **Warning:**
100 this is usually a very bad idea for any actions other
101 than start.
102
103 *--skip-systemd-native*
104 Exits before doing anything if a systemd environment is detected
105 and the requested service is a native systemd unit.
106 This is useful for maintainer scripts that want to defer systemd
107 actions to ``deb-systemd-invoke``\(1p\)
108
109 STATUS CODES
110 ============
111
112 Should an init script be executed, ``invoke-rc.d``
113 always returns the status code
114 returned by the init script. Init scripts should not return status codes in
115 the 100+ range (which is reserved in Debian and by the LSB). The status codes
116 returned by invoke-rc.d proper are:
117
118 0
119 *Success*.
120 Either the init script was run and returned exit status 0 (note
121 that a fallback action may have been run instead of the one given in the
122 command line), or it was not run because of runlevel/local policy constrains
123 and ``--disclose-deny`` is not in effect.
124
125 1 - 99
126 Reserved for init.d script, usually indicates a failure.
127
128 100
129 **Init script ID (**\ *name*\ **) unknown.**
130 This means the init script was not registered successfully through
131 ``update-rc.d`` or that the init script does not exist.
132
133 101
134 **Action not allowed**.
135 The requested action will not be performed because of runlevel or local
136 policy constraints.
137
138 102
139 **Subsystem error**.
140 Init script (or policy layer) subsystem malfunction. Also, forced
141 init script execution due to *--try-anyway* or *--force*
142 failed.
143
144 103
145 *Syntax error.*
146
147 104
148 *Action allowed*.
149 Init script would be run, but ``--query`` is in effect.
150
151 105
152 *Behavior uncertain*.
153 It cannot be determined if action should be carried out or not, and
154 ``--query``
155 is in effect.
156
157 106
158 *Fallback action requested*.
159 The policy layer denied the requested action, and
160 supplied an allowed fallback action to be used instead.
161
162
163 INIT SCRIPT POLICY
164 ==================
165
166 ``invoke-rc.d``
167 introduces the concept of a policy layer which is used to verify if
168 an init script should be run or not, or if something else should be
169 done instead. This layer has various uses, the most immediate ones
170 being avoiding that package upgrades start daemons out-of-runlevel,
171 and that a package starts or stops daemons while inside a chroot
172 jail.
173
174 The policy layer has the following abilities: deny or approve the
175 execution of an action; request that another action (called a
176 *fallback*)
177 is to be taken, instead of the action requested in invoke-rc.d's
178 command line; or request multiple actions to be tried in order, until
179 one of them succeeds (a multiple *fallback*).
180
181 ``invoke-rc.d``
182 itself only pays attention to the current runlevel; it will block
183 any attempts to start a service in a runlevel in which the service is
184 disabled. Other policies are implemented with the use of the
185 ``policy-rc.d``
186 helper, and are only available if
187 ``/usr/sbin/policy-rc.d``
188 is installed in the system.
189
190
191 FILES
192 =====
193
194 /etc/init.d/*
195 System V init scripts.
196
197 /usr/sbin/policy-rc.d
198 Init script policy layer helper (not required).
199
200 /etc/rc?.d/*
201 System V runlevel configuration.
202
203 NOTES
204 =====
205
206 ``invoke-rc.d`` special cases the *status*
207 action, and returns exit status 4 instead of exit status 0 when
208 it is denied.
209
210 BUGS
211 ====
212
213 See http://bugs.debian.org/sysv-rc and
214 http://bugs.debian.org/init-system-helpers.
215
216 SEE ALSO
217 ========
218
219 | *Debian Policy manual*,
220 | ``/etc/init.d/skeleton``,
221 | ``update-rc.d``\(8\),
222 | ``init``\(8\),
223 | ``/usr/share/doc/init-system-helpers/README.policy-rc.d.gz``