From 5a318ce649a7a5f754892518a4452a519b41dac8 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 4 Dec 2020 07:25:12 +0000 Subject: Big signal/command semantics change to svscan/supervise; add s6-svperms. --- doc/s6-svscan.html | 149 +++++++++++++++++++++++++---------------------------- 1 file changed, 69 insertions(+), 80 deletions(-) (limited to 'doc/s6-svscan.html') diff --git a/doc/s6-svscan.html b/doc/s6-svscan.html index 3a93e00..5d92174 100644 --- a/doc/s6-svscan.html +++ b/doc/s6-svscan.html @@ -27,7 +27,7 @@ the root or a branch of a supervision tree.

Interface

-     s6-svscan [ -S | -s ] [ -d notif ] [ -X consoleholder ] [ -c max ] [ -t rescan ] [ scandir ]
+     s6-svscan [ -d notif ] [ -X consoleholder ] [ -c max ] [ -t rescan ] [ scandir ]
 

Options

Signals

- s6-svscan always reacts to the following signals: + s6-svscan has special handling for the following signals:

- By default, it also reacts to the following signals: + Signals that are not in the above list are not caught by s6-svscan and will +have the system's default effect.

- -

- But if the -s option was given, then instead of those default actions, -s6-svscan uses configurable handlers: it forks and executes a program every time -it receives one of the following signals. + The behaviour for the first three signals in the list is always fixed:

- If an action cannot be taken (the relevant file doesn't exist, or isn't -executable, or any kind of error happens), s6-svscan prints a warning -message to its standard error but does nothing else with the signal. -

- -

- The -s mechanism is useful, for instance, when s6-svscan is running as -process 1 and needs to trap signals such as SIGINT (sent on some systems by -a Ctrl-Alt-Del press) in order to perform some specific work instead of -executing into .s6-svscan/finish on the spot. + The behaviour for the rest of the list is configurable: on receipt of a +SIGFOO, +s6-svscan will try to run an executable .s6-svscan/SIGFOO file. For +instance, a .s6-svscan/SIGTERM executable script will be run on receipt of +a SIGTERM. If the file cannot be found, or cannot be executed for any reason, the +default behaviour for the signal will be applied. Default behaviours are:

-

- s6-svscan will not exit its loop on its own when it receives a signal such as -SIGINT and the -s option has been given. To make it exit its loop, -invoke a s6-svscanctl command from the signal -handling script. For instance, a .s6-svscan/SIGINT script could look -like this: -

- -
  #!/command/execlineb -P
-  foreground { shutdown-the-services }
-  s6-svscanctl -i .
-
+

The reaper

@@ -189,9 +189,10 @@ one second later.

The scanner

- Every rescan milliseconds, or upon receipt of a SIGALRM or a + Upon receipt of a SIGALRM or a s6-svscanctl -a command, s6-svscan runs a -scanner routine. +scanner routine. (It also runs it every rescan milliseconds +if the -t option has been given.)

@@ -217,8 +218,8 @@ Every service the scanner finds is flagged as "active". started in an earlier scan, but the current scan can't find the corresponding directory, the service is then flagged as inactive. No command is sent to stop inactive s6-supervise processes (unless the administrator -uses s6-svscanctl -n), but inactive -s6-supervise processes will not be restarted if they die. +uses s6-svscanctl -n or a SIGHUP), but +inactive s6-supervise processes will not be restarted if they die.

Notes

@@ -238,22 +239,10 @@ process commands at any time, even when the computer is in trouble. memory. However, s6-svscan uses opendir(), and most opendir() implementations internally use heap memory - so unfortunately, it's impossible to guarantee that s6-svscan does not use heap memory at all. -
  • When run with the -t0 option, s6-svscan never polls, -it only wakes up on notifications, just like s6-supervise. The s6 supervision -tree can be used in energy-critical environments.
  • -
  • The supervision tree (i.e. the tree of processes made of s6-svscan and -all its scions) is not supposed to have a controlling terminal; s6-svscan -generally is either process 1 or a child of process 1, not something that is -launched from a terminal. If you run s6-svscan from an interactive shell, be -warned that typing ^C in the controlling terminal (which sends a SIGINT to -all processes in the foreground process group in the terminal) will terminate -the supervision tree, but not the supervised processes - so, the supervised -processes will keep running as orphans. This is by design: supervised -processes should be as resilient as possible, even when their supervisors -die. However, if you want to launch s6-svscan from an interactive shell and -need your services to die with the supervision tree when you ^C it, you can -obtain this behaviour by creating ./nosetsid files in every -service directory.
  • +
  • Unless run with a nonzero -t option, which is only a legacy +feature used to emulate other supervision suites such as daemontools or runit, +s6-svscan never polls; it only wakes up on notifications. +The s6 supervision tree can be used in energy-critical environments.
  • -- cgit v1.2.3