s6: the s6-svscanboot program
Keywords: s6 command s6-svscanboot scandir supervision supervise svscan logging catch-all directory

s6
Software
www.skarnet.org

# The s6-svscanboot program

`s6-svscanboot` starts a supervision tree, spearheaded by s6-svscan, while logging its own output, as well as the output of the tree's s6-supervise processes, into a catch-all logger that it itself supervises.

In other words, it starts a self-sufficient, self-contained supervision tree, that does not leak logs &emdash; apart from exceptionally rare error messages from the catch-all logger itself.

`s6-svscanboot` is meant to be used when an external service manager needs to start an s6 supervision tree. It prevents the supervision tree's logs from either flooding the upper service manager or being lost entirely.

## Interface

         s6-svscanboot [ -c devconsole ] [ -D catchalldir ] [ -m catchallmode ] [ -l catchalluser ] [ -o catchalloptions ] [ -d notif ] [ -X consoleholder ] [ -C services_max ] [ -L name_max ] [ -t rescan ] scandir

- `s6-svscanboot` creates the `/run/uncaught-logs` directory if it does not already exist, and changes its mode to 02750.
- It creates the scandir directory if it does not exist yet.
- It deletes any pre-existing `scandir/s6-svscan-log` directory, then recreates it as a suitable service directory running s6-log to log to `/run/uncaught-logs`. This is the service that will serve as the catch-all logger.
- It redirects its standard input to `/dev/null`, and its standard output and error to a named pipe that will be read by the catch-all logger. It performs the necessary magic so that the redirection happens even though that named pipe has no reader yet.
- It execs into s6-svscan, running on scandir.

## Exit codes

100
  Wrong usage
111
  System call failure

On success, `s6-svscanboot` does not exit, but execs into s6-svscan instead, which is supposed to remain running until the administrator decides to stop it or the machine shuts down.

## Options

`-c console`, `--console=console`
  Send the catch-all logger's error messages to device console. These will be the only error messages from the supervision tree that will not go into the catch-all logger. By default, this device is whatever `s6-svscanboot` stderr points to at invocation time.
`-D dir`, `--catchall-directory=dir`
  The directory where the s6-log catch-all will write and rotate the supervision tree's logs. Default is `/run/uncaught-logs`.
`-m mode`, `--catchall-mode=mode`
  What permissions the catch-all directory shall have. Default is 02750.
`-l user`, `--catchall-user=user`
  What user the catch-all logger shall run as. Default is the same user as the supervision tree, i.e. the user that launched `s6-svscanboot`. This option should only be used by root.
`-o options`, `--catchall-options=options`
  What control and selection directives the s6-log program shall use for logging its input. Directives should be separated by spaces. The options string will appear verbatim in the `scandir/s6-svscan-log/run` script, so caution should be used when using this option. Default is `t`.
`-d notif`, `--notification-fd=notif`
  Notify file descriptor notif when s6-svscan is ready. This option is passed directly to s6-svscan.
`-C services_max`, `--services-max=services_max`
  Maintain services for up to services_max service directories, including loggers. This option is passed directly to s6-svscan.
`-L name_max`, `--name-max=name_max`
  The maximum length of a name in the scan directory. This option is passed directly to s6-svscan.
`-t rescan`, `--timeout=rescan`
  Perform a scan every rescan milliseconds. This option is passed directly to s6-svscan.

## Notes

- `s6-svscanboot` is only useful in situations where it is beneficial for a supervision tree to log its own output. In other situations, it is better to launch s6-svscan directly.