diff options
| author | PS <p@0x53.net> | 2026-02-01 12:02:03 +0100 |
|---|---|---|
| committer | PS <p@0x53.net> | 2026-02-01 12:02:03 +0100 |
| commit | 980c5408489a3a3a56e49c3873f1bce6a0155cad (patch) | |
| tree | 91df5fa62e7eca03d04b8ed114b20b337b99a556 /src/bin/system-shutdown-daemon | |
| download | goetia-base-980c5408489a3a3a56e49c3873f1bce6a0155cad.tar.gz goetia-base-980c5408489a3a3a56e49c3873f1bce6a0155cad.tar.bz2 goetia-base-980c5408489a3a3a56e49c3873f1bce6a0155cad.zip | |
version 0.2.0.0
Diffstat (limited to 'src/bin/system-shutdown-daemon')
| -rwxr-xr-x | src/bin/system-shutdown-daemon | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/bin/system-shutdown-daemon b/src/bin/system-shutdown-daemon new file mode 100755 index 0000000..6419bfb --- /dev/null +++ b/src/bin/system-shutdown-daemon @@ -0,0 +1,31 @@ +#!@shebangdir@/execlineb -P + +# ISC license. + +tryexec { ./stage3b } + +if -n { + foreground { echo "\nsystem-shutdown!\n" } + foreground { s6-rc -l @tmpfsdir@/@sysrundir@/s6-rc -v2 -b -Da -t@timeout@ change } + foreground { + pipeline { ls -1 @tmpfsdir@/@sysrundir@/service/ } + pipeline { + sed + -e /s6-svscan-log/d + -e /.s6-svscan/d + -e /goetia-shutdown/d + -e /goetia-rescue/d + } + forstdin -pE SERVICE + s6-svc -T @timeout@ -D @tmpfsdir@/@sysrundir@/service/${SERVICE} + } + + foreground { rm -Rf -- @syslogdir@/uncaught-logs } + foreground { cp -Rpf -- @tmpfsdir@/@sysrundir@/log/uncaught-logs @syslogdir@/ } + + foreground { chmod u+x ./stage3b } + foreground { echo "sending all processes the TERM signal..." } + foreground { kill -SIGTERM -- -1 } +} +foreground { touch ./down } +chmod a-x ./stage3b |
