From cd80da7aea03223c2786be2026cc627c5d7363a8 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Thu, 26 Jul 2012 09:54:21 -0400 Subject: add an upstart init job that logs shutdowns and reboots. LP: #1018554 --- upstart/cloud-log-shutdown.conf | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 upstart/cloud-log-shutdown.conf (limited to 'upstart') diff --git a/upstart/cloud-log-shutdown.conf b/upstart/cloud-log-shutdown.conf new file mode 100644 index 00000000..2985d349 --- /dev/null +++ b/upstart/cloud-log-shutdown.conf @@ -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 -- cgit v1.2.3