Created
June 3, 2018 13:53
-
-
Save massimomusante/a7a6976654cb832ca7b523e903b0209e to your computer and use it in GitHub Desktop.
Listen for shutdown shell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: listen-for-shutdown.py | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
### END INIT INFO | |
# If you want a command to always run, put it here | |
# Carry out specific functions when asked to by the system | |
case "$1" in | |
start) | |
echo "Starting listen-4-shutdown.py" | |
/usr/local/bin/listen-4-shutdown.py & | |
;; | |
stop) | |
echo "Stopping listen-4-shutdown.py" | |
pkill -f /usr/local/bin/listen-4-shutdown.py | |
;; | |
*) | |
echo "Usage: /etc/init.d/listen-4-shutdown {start|stop}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment