slew/init/rc.halt

44 lines
1.0 KiB
Plaintext
Executable File

#!/bin/execlineb -P
cd /
redirfd -w 1 /dev/console
fdmove -c 2 1
wait -r { }
foreground { echo "* halt: syncing disks..." }
foreground { sync }
foreground { echo "* halt: sending SIGTERM/SIGCONT to processes..." }
foreground {
redirfd -w 2 /dev/null
s6-svc -T 500 -wD /run/service/s6-svscan.log
}
foreground { kill -TERM -1 }
foreground { kill -CONT -1 }
foreground { sleep 2 }
foreground { echo "* halt: sending SIGKILL to processes..." }
foreground { kill -KILL -1 }
wait -t 10 { }
foreground { echo "* halt: saving clock and stray logs..." }
foreground {
cd /run/uncaught-logs
redirfd -r 0 current
redirfd -w 1 /dev/null
s6-setuidgid _catchlog
/etc/slew/init/save_log.rc /var/log/init 6 5000000
}
foreground { /etc/slew/init/save_clock.rc }
foreground { echo "* halt: unmounting filesystems, disabling swap..." }
foreground { /etc/slew/init/umount.rc }
foreground { swapoff -a }
foreground { echo "* halt: remounting rootfs read-only..." }
foreground { mount -n -o remount,ro / }
foreground { sync }
/etc/slew/init/hpr.rc