SUPERVISE-DAEMON(8) | System Manager's Manual (smm) | SUPERVISE-DAEMON(8) |
supervise-daemon
—
starts a daemon and restarts it if it crashes
supervise-daemon |
servicename -a ,
--healthcheck-timer seconds
-A , --healthcheck-delay
seconds -D ,
--respawn-delay seconds
-d , --chdir
path -e ,
--env var=value
-g , --group
group -I ,
--ionice arg
-k , --umask
value -m ,
--respawn-max count
-N , --nicelevel
level --oom-score-adj
adj -p ,
--pidfile supervisorpidfile
-P , --respawn-period
seconds -R ,
--retry arg
-r , --chroot
chrootpath -u ,
--user user
-1 , --stdout
logfile -2 ,
--stderr logfile
-S , --start
daemon [-- ]
[arguments] |
supervise-daemon |
servicename -K , --stop
daemon -r ,
--chroot chrootpath |
supervise-daemon |
servicename -s , --signal
signal -r ,
--chroot chrootpath |
supervise-daemon
provides a consistent
method of starting, stopping and restarting daemons. If
-K
, --stop
or
-s
, --signal
is not
provided, then we assume we are starting the daemon.
supervise-daemon
only works with daemons which do
not fork. If your daemon has options to tell it not to fork, it should be
configured to not fork.
Here are the options to specify the daemon and how it should start or stop:
-u
,
--user
user[:group]-v
,
--verbose
The options are as follows:
-a
,
--healthcheck-timer
seconds-A
,
--healthcheck-delay
seconds-D
,
--respawn-delay
seconds-d
,
--chdir
path-e
,
--env
VAR=VALUE-g
,
--group
group-I
,
--ionice
class[:data]-k
,
--umask
mode-m
,
--respawn-max
countsupervise-daemon
will give up and exit. The
default is 10 and 0 means unlimited.
If respawn-period is also set, more than respawn-max crashes
must occur during respawn-period seconds to cause
supervise-daemon
to give up and exit.
-p
,
--pidfile
supervisorpidfile-N
,
--nicelevel
level--oom-score-adj
adj-P
,
--respawn-period
seconds-R
,
--retry
timeout |
signal/timeout-r
,
--chroot
path-
, --signal
signal-u
,
--user
user-1
,
--stdout
logfile-r
, --chroot
. The logfile
can also be a named pipe.-2
,
--stderr
logfile-1
,
--stdout
but with the standard error output.--capabilities
cap-list--secbits
sec-bits--no-new-privs
SSD_IONICELEVEL can also set the IO scheduling priority of the daemon, but the command line option takes precedence.
SSD_NICELEVEL can also set the scheduling priority of the daemon, but the command line option takes precedence.
SSD_OOM_SCORE_ADJ can also set the OOM score adjustment of the daemon, but the command line option takes precedence.
supervise-daemon
uses
getopt(3) to parse its options, which allows it to accept
the `--' option which will cause it to stop processing options at that
point. Any subsequent arguments are passed as arguments to the daemon to
start and used when finding a daemon to stop or signal.
If respawn-delay, respawn-max and respawn-period are not set correctly, it is possible to trigger a situation in which the supervisor will infinitely try to respawn a daemon. To avoid this, if you change the values of --respawn-delay, --respawn-max or --respawn-period, always make sure the settings make sense. For example, a respawn period of 5 seconds with a respawn max of 10 and a respawn delay of 1 second leads to infinite respawning since there can never be 10 respawns within 5 seconds.
Invoking supervise-daemon requires both the RC_SVCNAME environment variable to be set and the name of the service as the first argument on the command line, so it is best to invoke it inside a service script rather than manually.
supervise-daemon
first appeared in
Debian.
This is a complete re-implementation with the process finding code in the OpenRC library (librc, -lrc) so other programs can make use of it.
William Hubbs <w.d.hubbs@gmail.com>
April 27, 2016 | OpenRC |