From ffb9de6131bb7b6b8bb2a57d135160e177587002 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Fri, 18 Jun 2021 15:47:13 +0000 Subject: Add lock-fd feature to s6-supervise Signed-off-by: Laurent Bercot --- doc/servicedir.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'doc') diff --git a/doc/servicedir.html b/doc/servicedir.html index 0eadb4c..75f08f9 100644 --- a/doc/servicedir.html +++ b/doc/servicedir.html @@ -94,6 +94,7 @@ them afterwards. daemon. That process must not "background itself": being run by a supervision tree already makes it a "background" task. +
  • An optional executable file named finish. Like run, it can be any executable file. This finish script, if present, is executed everytime the run script dies. Generally, its main @@ -118,14 +119,17 @@ the service dies, via a s6-svc -x command or a SIGHUP, then the next invocation of finish will (obviously) be the last, and it will run with stdin and stdout pointing to /dev/null.
  • +
  • A directory named supervise. It is automatically created by s6-supervise if it does not exist. This is where s6-supervise stores its information. The directory must be writable.
  • +
  • An optional, empty, regular file named down. If such a file exists, the default state of the service is considered down, not up: s6-supervise will not automatically start it until it receives a s6-svc -u command. If no down file exists, the default state of the service is up.
  • +
  • An optional regular file named notification-fd. If such a file exists, it means that the service supports readiness notification. The file must only @@ -140,6 +144,20 @@ notification from the service and broadcast readiness, i.e. any s6-svlisten1 -U or s6-svlisten -U processes will be triggered.
  • + +
  • An optional regular file named lock-fd. If such a file +exists, it must contain an unsigned integer, representing a file descriptor that +will be open in the service. The service should not write to that descriptor +and should not close it. In other words, it should totally ignore it. That +file descriptor holds a lock, that will naturally be released when the service dies. +The point of this feature is to prevent s6-supervise from accidentally spawning several +copies of the service in case something goes wrong: for instance, the service +backgrounds itself (which it shouldn't do when running under a supervision suite), or +s6-supervise is killed, restarted by s6-svscan, and attempts to start another copy of +the service while the first copy is still alive. If s6-supervise detects that the lock +is held when it tries to start the service, it will print a warning message and delay +the starting attempt for 60 seconds.
  • +
  • An optional regular file named timeout-kill. If such a file exists, it must only contain an unsigned integer t. If t is nonzero, then on receipt of an s6-svc -d command, @@ -150,12 +168,14 @@ milliseconds, then it is sent a SIGKILL. If timeout-kill does not exist, or contains 0 or an invalid value, then the service is never forcibly killed (unless, of course, an s6-svc -k command is sent).
  • +
  • An optional regular file named timeout-finish. If such a file exists, it must only contain an unsigned integer, which is the number of milliseconds after which the ./finish script, if it exists, will be killed with a SIGKILL. The default is 5000: finish scripts are killed if they're still alive after 5 seconds. A value of 0 allows finish scripts to run forever.
  • +
  • An optional regular file named max-death-tally. If such a file exists, it must only contain an unsigned integer, which is the maximum number of service death events that s6-supervise will keep track of. If the service dies @@ -163,16 +183,19 @@ more than this number of times, the oldest events will be forgotten. Tracking death events is useful, for instance, when throttling service restarts. The value cannot be greater than 4096. If the file does not exist, a default of 100 is used.
  • +
  • An optional regular file named down-signal. If such a file exists, it must only contain the name or number of a signal, followed by a newline. This signal will be used to kill the supervised process when a s6-svc -d or s6-svc -r command is used. If the file does not exist, SIGTERM will be used by default.
  • +
  • A fifodir named event. It is automatically created by s6-supervise if it does not exist. foo/event is the rendez-vous point for listeners, where s6-supervise will send notifications when the service goes up or down.
  • +
  • An optional service directory named log. If it exists and foo is in a scandir, and s6-svscan runs on that scandir, then two services are monitored: foo and -- cgit v1.2.3