aboutsummaryrefslogtreecommitdiffstats
path: root/doc/service/system
diff options
context:
space:
mode:
authorPS <p@0x53.net>2026-02-07 10:37:36 +0100
committerPS <p@0x53.net>2026-02-07 10:37:36 +0100
commit02a071125de739ed54660ad014ffd57c42516abf (patch)
tree719d4127af9dc8dfa854042be8b47d3bf7356ef7 /doc/service/system
parent291a2d0ad47d29d7f4e83da47efb3a125f3667fc (diff)
downloadgoetia-linux-init-02a071125de739ed54660ad014ffd57c42516abf.tar.gz
goetia-linux-init-02a071125de739ed54660ad014ffd57c42516abf.tar.bz2
goetia-linux-init-02a071125de739ed54660ad014ffd57c42516abf.zip
Add doc
Diffstat (limited to 'doc/service/system')
-rw-r--r--doc/service/system/.s6-svscan.html38
-rw-r--r--doc/service/system/goetia-shutdown.html133
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..2b1b437
--- /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-linux-init">goetia-linux-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..2dd3728
--- /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 Linux providing the actual shutdown procedure." />
+ <meta name="Keywords" content="goetia s6 s6-rc service Linux shutdown" />
+ </head>
+ <header>
+ <p>
+ <a href="//0x53.net/software/goetia/goetia-linux-init">goetia-linux-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>linux-powertool ${DIRECTIVE}</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-linux-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>