diff options
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 |
