I'm executing a script on Ubuntu 14.04.1 LTS when the server is stopping
But I would like to execute it only on shutdown behavior, not whendoing a reboot.
I tried to get the value with $1but for reboot or shutdown, but it always sending a stop message
The script I'm currently running:
#! /bin/sh
### BEGIN INIT INFO
# Provides: shutdown
# Required-Start:
# Required-Stop: sendsigs
# Default-Start:
# Default-Stop: 0 6
# Short-Description: shutdown
# Description:
### END INIT INFO
shutdown_script.sh
exit 0
And run by
sudo update-rc.d shutdown_job start 19 0 6 .
shutdown -hwill be runlevel 0.shutdown -rwill be runlevel 6. There's no "shutdown + reboot"; a shutdown ends with the system halted, a restart results in the system rebooting. – roadmr Jul 24 '15 at 17:46
– leo Jul 28 '15 at 00:26sudo update-rc.d -f shutdown_job removesudo update-rc.d shutdown_job start 19 0 .