HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //etc/init/cloud-log-shutdown.conf
# 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
  { read seconds idle < /proc/uptime; } 2>/dev/null || :
  echo "$date: shutting down for $mode${seconds:+ [up ${seconds%.*}s]}."
end script