# INVOKE-RC.D - executes System-V style init script actions - man(8) - [phpMan]

[_INVOKE-RC.D_(8)](https://www.chedong.com/phpMan.php/man/INVOKE-RC.D/8/markdown)                            Debian GNU/Linux                            [_INVOKE-RC.D_(8)](https://www.chedong.com/phpMan.php/man/INVOKE-RC.D/8/markdown)

## NAME
       invoke-rc.d - executes System-V style init script actions

## 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_ ac‐
       tions, obeying runlevel constraints as well as any local policies set by the system  adminis‐
       trator.

       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)](https://www.chedong.com/phpMan.php/man/init/8/markdown).  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-re‐_
       _load_,  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  ac‐
       tive.

       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)](https://www.chedong.com/phpMan.php/man/deb-systemd-invoke/1p/markdown)

## 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 fall‐
              back 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 ef‐
              fect.

       **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 success‐
              fully 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; re‐
       quest 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 imple‐
       mented with the use of the **policy-rc.d **helper,  and  are  only  available  if  **/usr/sbin/pol‐**
       **icy-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)](https://www.chedong.com/phpMan.php/man/update-rc.d/8/markdown),
       [**init**(8)](https://www.chedong.com/phpMan.php/man/init/8/markdown),
### /usr/share/doc/init-system-helpers/README.policy-rc.d.gz


## AUTHOR
       Henrique de Moraes Holschuh

       License: GNU General Public License v2 or Later (GPLv2+)

## COPYRIGHT
       2001 Henrique de Moraes Holschuh


1 March 2001                                                                          [_INVOKE-RC.D_(8)](https://www.chedong.com/phpMan.php/man/INVOKE-RC.D/8/markdown)
