Last active
September 27, 2016 03:33
-
-
Save hornc/9fcff5713bc54a67cdc225a56776e957 to your computer and use it in GitHub Desktop.
basic sysv service statup script for init.d
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/bash | |
# | |
# /etc/rc.d/init.d/<servicename> | |
servicename="<servicename" | |
script="/home/root/servicename.sh" | |
case "$1" in | |
start) | |
echo -n "Starting $servicename service: " | |
$script > /dev/null 2>&1 & | |
;; | |
stop) | |
echo -n "Shutting down $servicename service: " | |
;; | |
status) | |
# <rough and ready report of the status of the service using ps output> | |
ps aux | grep "[ ]$script" | |
;; | |
restart) | |
# <restart the daemons, normally with $0 stop; $0 start> | |
;; | |
*) | |
echo "Usage: $servicename {start|stop|status|restart}" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment