Created
April 7, 2022 03:56
-
-
Save haxpor/0cee9e5988ce44937d078d783ae7c85d to your computer and use it in GitHub Desktop.
rc script to execute command(s) when system is up or down. Note the header lines which is required to have.
This file contains hidden or 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/bash | |
### BEGIN INIT INFO | |
# Provides: <your service name> | |
# Required-Start: $network $syslog | |
# Required-Stop: $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 6 | |
# Short-Description: execute commands when system is up or down | |
# Description: execute commands when system is up or down | |
### END INIT INFO | |
case "$1" in | |
start) | |
<do something here when system is up> | |
;; | |
stop) | |
<do something here when system is down> | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment