add an upstart init job that logs shutdowns and reboots.

This commit is contained in:
Scott Moser 2012-07-26 09:54:21 -04:00
parent aef06d4f60
commit 3a79a74ade

View File

@ -0,0 +1,18 @@
# log shutdowns and reboots to the console (/dev/console)
# this is useful for correlating logs
start on runlevel PREVLEVEL=2
task
console output
script
# runlevel(7) says INIT_HALT will be set to HALT or POWEROFF
date=$(date --utc)
case "$RUNLEVEL:$INIT_HALT" in
6:*) mode="reboot";;
0:HALT) mode="halt";;
0:POWEROFF) mode="poweroff";;
0:*) mode="shutdown-unknown";;
esac
echo "$date: shutting down for $mode"
end script