add an upstart init job that logs shutdowns and reboots.
This commit is contained in:
parent
aef06d4f60
commit
3a79a74ade
18
upstart/cloud-log-shutdown.conf
Normal file
18
upstart/cloud-log-shutdown.conf
Normal 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
|
Loading…
x
Reference in New Issue
Block a user