summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--upstart/cloud-log-shutdown.conf18
1 files changed, 18 insertions, 0 deletions
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