Created
July 24, 2017 13:38
-
-
Save chenminhua/e3851f641da138f3eaf02d01f78585a3 to your computer and use it in GitHub Desktop.
service
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 | |
# | |
# chkconfig: 2345 77 22 | |
# description: Test Service | |
# | |
LOCKFILE=/var/lock/subsys/myservice | |
status() { | |
if [ -e $LOCKFILE ]; then | |
echo "Running..." | |
else | |
echo "Stopped" | |
fi | |
} | |
usage() { | |
echo "`basename $0` {start|stop|restart|status}" | |
} | |
case $1 in | |
start) | |
echo "starting..." | |
touch $LOCKFILE;; | |
stop) | |
echo "stopping" | |
rm -f $LOCKFILE &> /dev/null | |
;; | |
restart) | |
echo "Restarting...";; | |
status) | |
status;; | |
*) | |
usage;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment