diff options
Diffstat (limited to '')
-rw-r--r-- | man8/invoke-rc.d.rst | 223 | ||||
-rw-r--r-- | man8/service.rst | 88 | ||||
-rw-r--r-- | man8/update-rc.d.rst | 249 |
3 files changed, 560 insertions, 0 deletions
diff --git a/man8/invoke-rc.d.rst b/man8/invoke-rc.d.rst new file mode 100644 index 0000000..fc21a73 --- /dev/null +++ b/man8/invoke-rc.d.rst @@ -0,0 +1,223 @@ +=================== + invoke-rc.d +=================== + +--------------------------------------------------------- +executes System-V style init script actions +--------------------------------------------------------- + +:Manual section: 8 +:Manual group: Debian GNU/Linux +:Author: + Henrique de Moraes Holschuh + +:Version: 1 March 2001 +:Copyright: 2001 Henrique de Moraes Holschuh +:License: GNU General Public License v2 or Later (GPLv2+) + +SYNOPSIS +======== + +``invoke-rc.d`` [*--quiet*] [*--force*] [*--try-anyway*] [*--disclose-deny*] +[*--query*] [*--no-fallback*] *name* *action* [*init script parameters...*] + + +``invoke-rc.d`` [*--help*] + +DESCRIPTION +=========== + +``invoke-rc.d`` +is a generic interface to execute System V style init script +``/etc/init.d/``\ *name* +actions, obeying runlevel constraints as well as any local +policies set by the system administrator. + +All access to the init scripts by Debian packages' maintainer +scripts should be done through +``invoke-rc.d``. + +This manpage documents only the usage and behavior of +``invoke-rc.d``. +For a discussion of the System V style init script arrangements please +see ``init``\(8\). +More information on invoke-rc.d can be found in the section on +runlevels and init.d scripts of the +*Debian Policy Manual*. + + +INIT SCRIPT ACTIONS +=================== + +The standard actions are: +*start*, *stop*, *force-stop*, *restart*, *try-restart*, *reload*, +*force-reload*, and *status*. +Other actions are accepted, but they can cause problems to +``policy-rc.d`` (see the ``INIT SCRIPT POLICY`` section), so +warnings are generated if the policy layer is active. + +Please note that not all init scripts will implement all +the actions listed above, and that the policy layer may +override an action to another action(s), or even deny it. + +Any extra parameters will be passed to the init script(s) being +executed. + +If an action must be carried out regardless of any local +policies, use the *--force* switch. + +OPTIONS +======= + +*--help* + Display usage help. + +*--quiet* + Quiet mode, no error messages are generated. + +*--force* + Tries to run the init script regardless of policy and + init script subsystem errors. + **Use of this option in Debian maintainer scripts is severely discouraged.** + +*--try-anyway* + Tries to run the init script if a non-fatal error is + detected. + +*--disclose-deny* + Return status code 101 instead of status code 0 if + the init script action is denied by the policy layer. + +*--query* + Returns one of the status codes 100-106. Does not + run the init script, and implies *--disclose-deny* + and *--no-fallback*. + +*--no-fallback* + Ignores any fallback action requests by the policy + layer. + **Warning:** + this is usually a very bad idea for any actions other + than start. + +*--skip-systemd-native* + Exits before doing anything if a systemd environment is detected + and the requested service is a native systemd unit. + This is useful for maintainer scripts that want to defer systemd + actions to ``deb-systemd-invoke``\(1p\) + +STATUS CODES +============ + +Should an init script be executed, ``invoke-rc.d`` +always returns the status code +returned by the init script. Init scripts should not return status codes in +the 100+ range (which is reserved in Debian and by the LSB). The status codes +returned by invoke-rc.d proper are: + +0 + *Success*. + Either the init script was run and returned exit status 0 (note + that a fallback action may have been run instead of the one given in the + command line), or it was not run because of runlevel/local policy constrains + and ``--disclose-deny`` is not in effect. + +1 - 99 + Reserved for init.d script, usually indicates a failure. + +100 + **Init script ID (**\ *name*\ **) unknown.** + This means the init script was not registered successfully through + ``update-rc.d`` or that the init script does not exist. + +101 + **Action not allowed**. + The requested action will not be performed because of runlevel or local + policy constraints. + +102 + **Subsystem error**. + Init script (or policy layer) subsystem malfunction. Also, forced + init script execution due to *--try-anyway* or *--force* + failed. + +103 + *Syntax error.* + +104 + *Action allowed*. + Init script would be run, but ``--query`` is in effect. + +105 + *Behavior uncertain*. + It cannot be determined if action should be carried out or not, and + ``--query`` + is in effect. + +106 + *Fallback action requested*. + The policy layer denied the requested action, and + supplied an allowed fallback action to be used instead. + + +INIT SCRIPT POLICY +================== + +``invoke-rc.d`` +introduces the concept of a policy layer which is used to verify if +an init script should be run or not, or if something else should be +done instead. This layer has various uses, the most immediate ones +being avoiding that package upgrades start daemons out-of-runlevel, +and that a package starts or stops daemons while inside a chroot +jail. + +The policy layer has the following abilities: deny or approve the +execution of an action; request that another action (called a +*fallback*) +is to be taken, instead of the action requested in invoke-rc.d's +command line; or request multiple actions to be tried in order, until +one of them succeeds (a multiple *fallback*). + +``invoke-rc.d`` +itself only pays attention to the current runlevel; it will block +any attempts to start a service in a runlevel in which the service is +disabled. Other policies are implemented with the use of the +``policy-rc.d`` +helper, and are only available if +``/usr/sbin/policy-rc.d`` +is installed in the system. + + +FILES +===== + +/etc/init.d/* + System V init scripts. + +/usr/sbin/policy-rc.d + Init script policy layer helper (not required). + +/etc/rc?.d/* + System V runlevel configuration. + +NOTES +===== + +``invoke-rc.d`` special cases the *status* +action, and returns exit status 4 instead of exit status 0 when +it is denied. + +BUGS +==== + +See http://bugs.debian.org/sysv-rc and +http://bugs.debian.org/init-system-helpers. + +SEE ALSO +======== + +| *Debian Policy manual*, +| ``/etc/init.d/skeleton``, +| ``update-rc.d``\(8\), +| ``init``\(8\), +| ``/usr/share/doc/init-system-helpers/README.policy-rc.d.gz`` diff --git a/man8/service.rst b/man8/service.rst new file mode 100644 index 0000000..8c43980 --- /dev/null +++ b/man8/service.rst @@ -0,0 +1,88 @@ +=================== + service +=================== + +--------------------------------------------------------- +run a System V init script +--------------------------------------------------------- + +:Manual section: 8 +:Manual group: System Manager's Manual +:Author: + Miloslav Trmac <mitr@redhat.com>, + Petter Reinholdtsen <pere@hungry.com> + +:Version: Jan 2006 +:Copyright: 2006 Red Hat, Inc., Petter Reinholdtsen <pere@hungry.com> +:License: GNU General Public License v2 (GPLv2) + + +SYNOPSIS +======== + + +``service`` *SCRIPT* *COMMAND* [*OPTIONS*] + +``service`` ``--status-all`` + +``service`` ``--help`` | ``-h`` | ``--version`` + + +DESCRIPTION +=========== + +``service`` runs a System V init script or systemd unit in as predictable an +environment as possible, removing most environment variables and with the +current working directory set to ``/``. + + +The +*SCRIPT* +parameter specifies a System V init script, located in */etc/init.d/SCRIPT*, +or the name of a systemd unit. The existence of a systemd unit of the same +name as a script in ``/etc/init.d`` will cause the unit to take precedence +over the init.d script. +The supported values of *COMMAND* depend on the invoked script. ``service`` +passes *COMMAND* and *OPTIONS* to the init script unmodified. For systemd +units, start, stop, status, and reload are passed through to their +systemctl/initctl equivalents. + +All scripts should support at least the ``start`` and ``stop`` commands. +As a special case, if *COMMAND* is ``--full-restart``, the script is run +twice, first with the ``stop`` command, then with the ``start`` +command. Note, that unlike ``update-rc.d``\(8\), ``service`` does not +check ``/usr/sbin/policy-rc.d``. + +``service --status-all`` runs all init scripts, in alphabetical order, with +the ``status`` command. The status is [ + ] for running services, [ - ] for +stopped services and [ ? ] for services without a ``status`` command. This +option only calls status for sysvinit jobs. + +EXIT CODES +========== + +``service`` calls the init script and returns the status returned by it. + +FILES +========== + +``/etc/init.d`` + The directory containing System V init scripts. + +``/{lib,run,etc}/systemd/system`` + The directories containing systemd units. + +ENVIRONMENT +=========== + +``LANG``, ``LANGUAGE``, ``LC_CTYPE``, ``LC_NUMERIC``, ``LC_TIME``, ``LC_COLLATE``, ``LC_MONETARY``, ``LC_MESSAGES``, ``LC_PAPER``, ``LC_NAME``, ``LC_ADDRESS``, ``LC_TELEPHONE``, ``LC_MEASUREMENT``, ``LC_IDENTIFICATION``, ``LC_ALL``, ``TERM``, ``PATH`` + The only environment variables passed to the init scripts. + +SEE ALSO +======== + +| */etc/init.d/skeleton* +| ``update-rc.d``\(8\) +| ``init``\(8\) +| ``invoke-rc.d``\(8\) +| ``systemctl``\(1\) diff --git a/man8/update-rc.d.rst b/man8/update-rc.d.rst new file mode 100644 index 0000000..b1da14e --- /dev/null +++ b/man8/update-rc.d.rst @@ -0,0 +1,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) |