HEX
Server: nginx/1.29.3
System: Linux mail.sarafai.ru 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: root (0)
PHP: 7.4.33
Disabled: dl,exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
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