diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2018-01-13 14:33:25 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2018-01-13 14:33:25 +0000 |
commit | c2c14b525080203561d9e47d8a10442828342251 (patch) | |
tree | 11b5145ae7413ef577ad190315bfa147c23057c6 /examples | |
parent | 1bd507eda34de6945c18daa916fb64ad810fda5a (diff) | |
download | s6-linux-init-c2c14b525080203561d9e47d8a10442828342251.tar.xz |
Autogenerate final shutdown; rename rc.tini to rc.shutdown
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/rc.init | 12 | ||||
-rwxr-xr-x | examples/rc.shutdown | 30 | ||||
-rwxr-xr-x | examples/rc.tini | 16 |
3 files changed, 15 insertions, 43 deletions
diff --git a/examples/rc.init b/examples/rc.init index d71fd1a..afc7735 100755 --- a/examples/rc.init +++ b/examples/rc.init @@ -1,17 +1,9 @@ #!/bin/execlineb -P - -# Make sure the /dev/urandom entropy pool will be set in -# a not-too-distant future. Ideally we'd block on this, -# but it's not critical, so we don't. - -background -d { s6-fillurandompool } - - # Set the system clock to something sensible, -# to get coherent logs until the initial NTP message +# to get coherent logs until the initial NTP exchange -if { s6-clock @40000000596c000000000000 } +if { s6-clock @400000005a58000000000000 } # Initialize the service manager diff --git a/examples/rc.shutdown b/examples/rc.shutdown index 04d7357..14b4692 100755 --- a/examples/rc.shutdown +++ b/examples/rc.shutdown @@ -1,20 +1,16 @@ -#!/bin/execlineb -S0 +#!/bin/execlineb -P -foreground { s6-echo "Giving dying processes some grace time." } -foreground { s6-sleep 2 } -foreground { s6-echo "Syncing disks." } -foreground { s6-sync } -foreground { s6-echo "Sending all processes the TERM signal." } -foreground { s6-nuke -th } -foreground { s6-sleep 2 } -foreground { s6-echo "Sending all processes the KILL signal." } -foreground { s6-nuke -k } -wait { } -foreground { s6-echo "Syncing and unmounting disks." } -foreground { s6-sync } -foreground { s6-umount -a } -foreground { s6-mount -ro remount /dev/root / } +# Write a message to /var/log/syslogd -foreground { s6-echo "\nPerforming "${1}"." } -s6-${1} -f +foreground +{ + s6-ipcclient -l0 /dev/log + fdmove 1 7 + s6-echo "/etc/rc.shutdown: shutdown requested" +} + + +# Shut down all services + +s6-rc -da change diff --git a/examples/rc.tini b/examples/rc.tini deleted file mode 100755 index 02e7ec7..0000000 --- a/examples/rc.tini +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/execlineb -P - - -# Write a message to /var/log/syslogd - -foreground -{ - s6-ipcclient -l0 /dev/log - fdmove 1 7 - s6-echo "/etc/rc.tini: shutdown requested" -} - - -# Shut down all services - -s6-rc -da change |