I am trying to log shutdown/reboot on a Raspberry Pi. I am running latest Raspbian. This is my setup:
cat /etc/init.d/log-shutdown.sh
:
#!/bin/sh
### BEGIN INIT INFO
# Provides: log-shutdown
# Required-Start:
# Required-Stop: umountroot
# Should-Stop:
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Log shutdown date.
### END INIT INFO
echo "I ran">/log-shutdown
ls -Al /etc/init.d/log-shutdown.sh
:
-rwxr-xr-x 1 root root 258 Apr 15 20:10 /etc/init.d/log-shutdown.sh
ls -Al /etc/rc0.d/*log-shutdown*
lrwxrwxrwx 1 root root 25 Apr 15 19:41 /etc/rc0.d/K01log-shutdown.sh -> ../init.d/log-shutdown.sh
ls -Al /etc/rc6.d/*log-shutdown*
:
lrwxrwxrwx 1 root root 25 Apr 15 19:41 /etc/rc6.d/K01log-shutdown.sh -> ../init.d/log-shutdown.sh
After running sudo shutdown -r now
and waiting for the Pi to reboot, /log-shutdown
is not written to. Manually running sudo /etc/init.d/log-shutdown.sh
does write to the file. What am I doing wrong?
sudo runlevel
might tell you). – EightBitTony Apr 15 '16 at 19:41sudo runlevel
outputsN 3
. It is a headless server. – Mark Raymond Apr 15 '16 at 19:43