# shutdown # # crude hack to poweroff description "Shutdown" author "Arjan Bouter " start on shutdown task console output script echo "signalling everything to stop" initctl emit shutdown && sleep 5 for running_job in $(initctl list|grep running|awk -F' ' '{print $1}'); do if [[ "$running_job" = 'tty1' ]]; then echo "leave tty1 running, just in case..." elif [[ "$running_job" = 'shutdown' ]]; then echo "leave shutdown running, obviously" elif [[ "$running_job" = 'init' ]]; then echo "leave init running, obviously" else echo "Stopping job $running_job" stop $running_job fi done echo "unmounting filesystems" umount -a -t notmpfs killall udevd sync echo "powering off" poweroff -f end script