summaryrefslogtreecommitdiff
path: root/upstart/cloud-log-shutdown.conf
blob: 2985d349c05409e6c7b836c4d1243bd78527d3ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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