1# Replaces traditional overdesigned shutdown mechanism. 2# 3# No communication with init is necessary: 4# just ask all processes to exit. 5# Then unmount everything. Then reboot or power off. 6 7# Install /sbin/ symlinks named halt, reboot, poweroff 8# (and also possibly shutdown) to e.g. 9# /app/shutdown-1.0/script/shutdown: 10# 11ln -s /app/shutdown-1.0/script/shutdown /sbin/halt 12ln -s /app/shutdown-1.0/script/shutdown /sbin/reboot 13ln -s /app/shutdown-1.0/script/shutdown /sbin/poweroff 14# 15# shutdown spawns do_shutdown in new session, redirected to /dev/null, 16# tells user that shutdown is in progress, and sleeps 17# (for cosmetic reasons: do not confuse user by letting him 18# type more commands in this terminal). 19# 20# do_shutdown tries to switch to a VT console. 21# Then, (only if -r) it spawns a hardshutdown child, to reboot 22# unconditionally in 30 seconds if something later goes seriously bad. 23# Then it runs stop_tasks, writing to /var/log/reboot/YYYYMMDDhhmmss.log, 24# then it runs stop_storage. 25# Then it commands kernel to halt/reboot/poweroff, if requested. 26# Then it sleeps forever. 27# 28# Build the hardshutdown binary: 29# 30cd script && ./hardshutdown.make.sh 31