diff options
| author | PS <p@0x53.net> | 2026-02-07 10:34:21 +0100 |
|---|---|---|
| committer | PS <p@0x53.net> | 2026-02-07 10:34:21 +0100 |
| commit | eb36640078ee6469427e85ca0695f8c920909ea0 (patch) | |
| tree | 4e490a9b3b4e2f2c07bf261acde1d8ac70bb87d0 /doc/service/system | |
| parent | 891a3316a22acdc57a2e65429f4d59ada268410c (diff) | |
| download | goetia-freebsd-init-eb36640078ee6469427e85ca0695f8c920909ea0.tar.gz goetia-freebsd-init-eb36640078ee6469427e85ca0695f8c920909ea0.tar.bz2 goetia-freebsd-init-eb36640078ee6469427e85ca0695f8c920909ea0.zip | |
Add doc
Diffstat (limited to 'doc/service/system')
| -rw-r--r-- | doc/service/system/.s6-svscan.html | 38 | ||||
| -rw-r--r-- | doc/service/system/goetia-shutdown.html | 133 |
2 files changed, 171 insertions, 0 deletions
diff --git a/doc/service/system/.s6-svscan.html b/doc/service/system/.s6-svscan.html new file mode 100644 index 0000000..46e0db1 --- /dev/null +++ b/doc/service/system/.s6-svscan.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta http-equiv="Content-Language" content="en" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>system .s6-svscan</title> + <meta name="Description" content="Configuration directory for s6-svscan for the system supervision tree" /> + <meta name="Keywords" content="goetia s6 s6-svscan system supervision tree" /> + </head> + <header> + <p> + <a href="//0x53.net/software/goetia/goetia-freebsd-init">goetia-freebsd-init</a> + <br /> + <a href="//0x53.net/software/goetia">goetia</a> + <br /> + <a href="//0x53.net/software">Software</a> + <br /> + <a href="//0x53.net">0x53.net</a> + </p> + </header> + <body> + <h1>The system .s6-svscan directory</h1> + <p> + The .s6-svscan directory contains scripts + that are executed if + <a href="https://skarnet.org/software/s6/s6-svscan.html">s6-svscan</a> + receives a signal or exits. + In this case its main use is to properly shutdown + the system using <code>system-shutdown</code> + upon receiving certain signals. + </p> + <p> + The .s6-svscan directory is easily overlooked, + do not forget to symlink/copy it! + </p> + </body> +</html> diff --git a/doc/service/system/goetia-shutdown.html b/doc/service/system/goetia-shutdown.html new file mode 100644 index 0000000..7f6a866 --- /dev/null +++ b/doc/service/system/goetia-shutdown.html @@ -0,0 +1,133 @@ +<!DOCTYPE html> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> + <meta http-equiv="Content-Language" content="en" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>goetia-shutdown</title> + <meta name="Description" content="Shutdown service for FreeBSD providing the actual shutdown procedure." /> + <meta name="Keywords" content="goetia s6 s6-rc service FreeBSD shutdown" /> + </head> + <header> + <p> + <a href="//0x53.net/software/goetia/goetia-freebsd-init">goetia-freebsd-init</a> + <br /> + <a href="//0x53.net/software/goetia">goetia</a> + <br /> + <a href="//0x53.net/software">Software</a> + <br /> + <a href="//0x53.net">0x53.net</a> + </p> + </header> + <body> + <h1>The goetia-shutdown service</h1> + <p> + goetia-shutdown is the service that starts + <a href="//0x53.net/software/goetia/goetia-base/bin/system-shutdown-daemon.html">system-shutdown-daemon</a>. + goetia-shutdown is down by default. + Starting it initiates the shutdown procedure. + </p> + <p> + goetia-shutdown consists of three scripts: + </p> + <h2>run</h2> + <ul> + <li> + This script just executes system-shutdown-daemon. + </li> + </ul> + <h2>stage3b</h2> + <ul> + <li> + stage3b tries to execute <code>./stage4</code>, + which is by default not executable. + If it can not execute <code>./stage4</code>, + and <em>only</em> in this case, + it continues with the following. + </li> + <li> + It makes <code>./stage4</code> executable. + </li> + <li> + It sends SIGCONT to all processes. + </li> + <li> + It sleeps for 1 second. + </li> + <li> + It writes a banner to its standard out. + </li> + <li> + It send SIGKILL to all processes. + </li> + <li> + This also stops the system-shutdown-daemon process. + It is automatically restarted by the system supervision tree, + but this time, <em>both</em> the files + <code>./stage3b</code> and + <code>./stage4</code> + are executable. + Which leads to the execution of <code>./stage4</code>. + </li> + </ul> + <h2>stage4</h2> + <ul> + <li> + stage4 reads the envdir at the + <code>shutdown-directive</code> subdirectory of the + <a href="//0x53.net/software/goetia/rundir.html#system">system runtimedirectory</a> + using + <a href="https://skarnet.org/software/s6/s6-envdir.html">s6-envdir</a>. + </li> + <li> + It reads the <code>DIRECTIVE</code> evironment variable, + defaulting to <code>-r</code>, if <code>DIRECTIVE</code> is + not specified. + </li> + <li> + It runs <code>umount -A</code>. + </li> + <li> + It remounts the root filesystem read-only. + </li> + <li> + It runs <code>shutdown -o ${DIRECTIVE} now</code>. + </li> + </ul> + <h2>Notes</h2> + <p> + The entire shutdown procedure roughly works as follows: + </p> + <ul> + <li> + This service, running + <a href="//0x53.net/software/goetia/goetia-base/bin/system-shutdown-daemon.html">system-shutdown-daemon</a> + gets the instructions from + <a href="//0x53.net/software/goetia/goetia-freebsd-init/bin/system-shutdown.html">system-shutdown</a> + to shutdown. + </li> + <li> + system-shutdown-daemon does most of the shutdown procedure. + Part of it is to make stage3b executable. + In the end, system-shutdown-daemon sends SIGTERM to all processes but + PID 1, including itself. + </li> + <li> + this service gets restarted automatically. + system-shutdown-daemon now instantly executes into stage3b. + </li> + <li> + stage3b makes stage4 executable. + Followed by sending SIGKILL to all processes + but PID 1, including itself. + </li> + <li> + The final restart of this service causes + system-shutdown-daemon to instantly execute into + stage3b which instantly executes into stage4, + which instructs the Kernel to do the actual + halt, poweroff or reboot. + </li> + </ul> + </body> +</html> |
