| 1 |
|
| 2 |
|
| 3 |
This is the internal documentation for invoke-rc.d, as |
| 4 |
written by Henrique M Holschuh <[email protected]> |
| 5 |
|
| 6 |
This document can be found on the web as well at |
| 7 |
http://people.debian.org/~hmh/invokerc.d-policyrc.d-specification.txt |
| 8 |
|
| 9 |
There is also the Debian BTS entry for the invoke-rc.d policy change at |
| 10 |
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=76868 |
| 11 |
|
| 12 |
|
| 13 |
INVOKE-RC.D (/usr/sbin/invoke-rc.d) interface: |
| 14 |
============================================== |
| 15 |
|
| 16 |
The interface for all implementations of invoke-rc.d is mandated by the base |
| 17 |
implementation in the sysvinit package, just like it is done for |
| 18 |
update-rc.d. |
| 19 |
|
| 20 |
There is a provision for a "local initscript policy layer" (read: a call to |
| 21 |
/usr/sbin/policy-rc.d if this executable is present in the local system), |
| 22 |
which allows the local system administrator to control the behaviour of |
| 23 |
invoke-rc.d for every initscript id and action. It is assumed that this |
| 24 |
script is OPTIONAL and will by written and provided by packages other than |
| 25 |
the initscript system (sysvinit and file-rc packages). |
| 26 |
|
| 27 |
The basic interface for all implementations of policy-rc.d is mandated by |
| 28 |
the requirements of the base implementation of invoke-rc.d. This interface |
| 29 |
will be described either in the manpage of invoke-rc.d, and in a text file |
| 30 |
stored in /usr/share/doc/sysvinit/ by package sysvinit (which will host the |
| 31 |
base implementation of invoke-rc.d). |
| 32 |
|
| 33 |
Proposed script interfaces: |
| 34 |
|
| 35 |
invoke-rc.d [options] <basename> <action> [extra initscript parameters...] |
| 36 |
|
| 37 |
basename - Initscript ID, as per update-rc.d(8) |
| 38 |
action - Initscript action. Known actions are: |
| 39 |
start, [force-]stop, [try-]restart, |
| 40 |
[force-]reload, status |
| 41 |
(status is there because of the LSB. Debian does not use it). |
| 42 |
|
| 43 |
extra initscript parameters: These parameters are passed to the initscript |
| 44 |
as is, after the action parameter. <action> is always the first paramenter |
| 45 |
to the initscript, and may be modified by fallback actions or policy-rc.d |
| 46 |
requests. Note, however, that the extra parameters are not dropped or |
| 47 |
modified even if the action (first parameter) is modified. |
| 48 |
|
| 49 |
Options: |
| 50 |
|
| 51 |
--quiet |
| 52 |
Quiet mode, no error messages are generated by invoke-rc.d; policy-rc.d |
| 53 |
is also called with --quiet if this option is in effect. |
| 54 |
|
| 55 |
--force |
| 56 |
Try to run init script regardless of policy and non-fatal errors. Use |
| 57 |
of this option in automated scripts is severely discouraged as it |
| 58 |
bypasses integrity checks. If the initscript cannot be executed, error |
| 59 |
status 102 is returned. Do note that the policy layer call |
| 60 |
(policy-rc.d) is NOT skipped, although its results are ignored. |
| 61 |
|
| 62 |
--try-anyway |
| 63 |
Try to run the initscript even if a non-fatal subsystem error is |
| 64 |
detected (e.g: bad rc.d symlinks). A 102 status exit code will result |
| 65 |
if init script fails to execute anyway). Unlike --force, policy is |
| 66 |
still enforced with --try-anyway. |
| 67 |
|
| 68 |
--disclose-deny |
| 69 |
Return status code 101 instead of status code 0 if initscript action is |
| 70 |
denied by local policy rules or runlevel constrains. An warning is |
| 71 |
generated if the action is denied. |
| 72 |
|
| 73 |
--query |
| 74 |
Returns one of status codes 100-106, does not execute the init.d |
| 75 |
script. Implies --disclose-deny and --nofallback. Status codes 104-106 |
| 76 |
are only generated by this option. |
| 77 |
|
| 78 |
Note many messages are still sent to stderr in --query mode, including |
| 79 |
those regarding policy overrides and subsystem errors. Use --quiet if |
| 80 |
silent --query operation is desired. |
| 81 |
|
| 82 |
--no-fallback |
| 83 |
The policy layer (policy-rc.d) may return fallback actions to be run |
| 84 |
instead of the requested action. If this option is active, a fallback |
| 85 |
action request will be ignored and a "action not allowed" reply used in |
| 86 |
its place. This is probably a BAD idea unless you know exactly what |
| 87 |
you're doing. |
| 88 |
|
| 89 |
--help |
| 90 |
Outputs help message to stdout |
| 91 |
|
| 92 |
Unknown actions may generate warnings, but are passed to the underlying |
| 93 |
initscript anyway. The reason for the warning is simple: It is very unlikely |
| 94 |
that an unknown action (by invoke-rc.d) will be known to the policy layer |
| 95 |
(policy-rc.d), and therefore it may cause an initscript to execute an action |
| 96 |
which the local system administrator would have not allowed had he known |
| 97 |
about it. If policy-rc.d is not present, no warnings for unknown actions |
| 98 |
are generated. |
| 99 |
|
| 100 |
Should an initscript be executed, invoke-rc.d ALWAYS returns the status code |
| 101 |
returned by the initscript. Initscripts should not return status codes in |
| 102 |
the 100+ range (this is also a LSB requirement). |
| 103 |
|
| 104 |
Exit status codes (LSB compatible): |
| 105 |
0 : success |
| 106 |
either the init script was run and returned exit status 0 (note |
| 107 |
that a fallback action may have been run instead of the one given |
| 108 |
in the command line), or it was not run because of runlevel/local |
| 109 |
policy constrains and --disclose-deny is not in effect. |
| 110 |
1 - 99 : reserved for init.d script |
| 111 |
100 : init script ID (basename) unknown |
| 112 |
init script not registered sucessfully through |
| 113 |
update-rc.d or init script does not exist. |
| 114 |
This error is fatal for most initscript systems. |
| 115 |
101 : action not allowed |
| 116 |
requested action will not be performed because of |
| 117 |
runlevel or local policy constrains, and |
| 118 |
--disclose-deny is in effect. Note that a fallback |
| 119 |
action is NOT considered "action not allowed", |
| 120 |
unless --nofalback is in effect. |
| 121 |
102 : subsystem error |
| 122 |
initscript (or policy) subsystem malfuncion. |
| 123 |
(e.g. broken /sbin/runlevel). |
| 124 |
Also, forced initscript execution due to |
| 125 |
--try-anyway or --force failed. |
| 126 |
103 : syntax error |
| 127 |
104 : action allowed |
| 128 |
--query is in effect; init script would be run if |
| 129 |
not for --query. |
| 130 |
105 : behaviour uncertain |
| 131 |
cannot determine if action should be carried out or |
| 132 |
not, and --query in effect. |
| 133 |
106 : fallback action requested |
| 134 |
the policy layer denied the requested action, and |
| 135 |
supplied an allowed fallback action. |