s6-linux-init: the s6-linux-init-shutdownd program
Keywords: s6 linux init administration root utilities shutdown halt poweroff reboot daemon shutdownd

s6-linux-init
Software
skarnet.org

# The `s6-linux-init-shutdownd` program

`s6-linux-init-shutdownd` is the daemon that manages the shutdown procedure for a s6-linux-init installation. It is not meant to be called directly by the user.

## Interface

         s6-linux-init-shutdownd [ -c basedir ] [ -g gracetime ] [ -C ] [ -B ]

- `s6-linux-init-shutdownd` opens a named pipe in its current directory and listens to it. This fifo has a fixed, internal, name: this is a rendezvous point where programs such as s6-linux-init-shutdown send their commands when they are told to trigger the shutdown procedure.
- When it receives a command to shut down, `s6-linux-init-shutdownd` first spawns the rc.shutdown script defined by the s6-linux-init-maker invocation that created the shutdownd service.
- When this script exits, `s6-linux-init-shutdownd` kills all processes, first with a SIGTERM, then (after the grace time specified by the shutdown command) with a SIGKILL.
- It then runs an automatically-generated script (called stage 4), which unmounts the file systems and halts, powers off or reboots the machine.

## Options

- `-c basedir` : look for the rc.shutdown script in the basedir`/scripts` directory. Default is `/etc/s6-linux-init/current`.
- `-g gracetime` : if the shutdown command does not specify a grace time between the SIGTERM and the SIGKILL, use gracetime milliseconds. Default is 3000.
- `-C` : inform the shutdown daemon that it is running in a container. This changes the nature of stage 4, since exiting a container is slightly different from rebooting a real machine (in particular, pid 1 has to exit, and great care must be given not to leave any zombie hanging around).
- `-B` : inform the shutdown daemon that no catch-all logger is running. This also changes the shutdown procedure slightly, since some operations are specific to the existence of a catch-all logger.

## Notes

- The s6-linux-init-shutdownd binary is not meant to be called directly by administrators. It is run by a s6 service that is automatically generated by s6-linux-init-maker.