The system-shutdown-daemon program
system-shutdown-daemon contains the Kernel independent part of the shutdown sequence. It is invoked by the Kernel specifict goetia-shutdown service, e.g. goetia-shutdown service for Linux or goetia-shutdown service for FreeBSD. system-shutdown-daemon is a long lived program that waits for instruction by the system-shutdown command The latter is part of the Kernel specific packages, e.g. goetia-linux or goetia-freebsd.
Interface
system-shutdown-daemon
- system-shutdown-daemon takes no arguments.
-
It tries to execute
./stage3b, which is by default not executable. If it can not execute./stage3b, and only in this case, it continues with the following. -
All services managed by
s6-rc
are stopped.
This means, all services defined in
source directories
at the
srcsubdirectory of the system configuration directory. - Next, all leftover services except s6-svscan-log, goetia-shutdown and goetia-rescue, are stopped.
-
The file
stage3b, expected to exist in the current working directory is made executable. This file is part of the Kernel secific service directories. (see e.g. goetia-shutdown) -
all uncaught system logs are copied from the
log/uncaught-logssubdirectory of the system runtime directory. to theuncaught-logssubdirectory of the system log directory. - SIGTERM is sent to all processes but PID 1.
-
This also stops the system-shutdown-daemon process.
It is automatically restarted by the system supervision tree,
but this time, the file
./stage3bis executable and executed instead of what is described above. What happens in./stage3bis Kernel specific, and documented on goetia-shutdown service for Linux, goetia-shutdown service for FreeBSD, etc.
Exit codes
- Since system-shutdown-daemon is an execline script, it exits with an approximation of employed program that failed.
- system-shutdown-daemon mostly uses execline and s6 software, the exit behaviour of which can be looked up on their respective pages.
- See also: execline exit code handling.
Options
- There are no options to system-shutdown-daemon.
