summaryrefslogtreecommitdiff
path: root/upstart
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2012-07-26 09:54:21 -0400
committerScott Moser <smoser@ubuntu.com>2012-07-26 09:54:21 -0400
commitcd80da7aea03223c2786be2026cc627c5d7363a8 (patch)
tree4ba126f7a0ecb297016228b86dbf4a21bd5838c1 /upstart
parenta37d2ee7d61bfc0a59590f76bb8426d4bf5dd1b1 (diff)
downloadvyos-cloud-init-cd80da7aea03223c2786be2026cc627c5d7363a8.tar.gz
vyos-cloud-init-cd80da7aea03223c2786be2026cc627c5d7363a8.zip
add an upstart init job that logs shutdowns and reboots.
LP: #1018554
Diffstat (limited to 'upstart')
-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