Last active
August 29, 2015 14:01
-
-
Save mrsinguyen/2f5c2f597984480bb190 to your computer and use it in GitHub Desktop.
tools.sh
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 | |
start () { | |
echo -n "Starting tools..." | |
# Start daemon | |
daemon --chdir='/var/www/tools' --command "/srv/bin/php -S 127.0.0.1:8000" --respawn --output=/var/log/tools/tools.log --name=tools --verbose | |
RETVAL=$? | |
if [ $RETVAL = 0 ] | |
then | |
echo "done." | |
else | |
echo "failed. See error code for more information." | |
fi | |
return $RETVAL | |
} | |
stop () { | |
# Stop daemon | |
echo -n "Stopping tools..." | |
daemon --stop --name=tools --verbose | |
RETVAL=$? | |
if [ $RETVAL = 0 ] | |
then | |
echo "Done." | |
else | |
echo "Failed. See error code for more information." | |
fi | |
return $RETVAL | |
} | |
restart () { | |
daemon --restart --name=tools --verbose | |
} | |
status () { | |
# Report on the status of the daemon | |
daemon --running --verbose --name=tools | |
return $? | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
status) | |
status | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
*) | |
echo $"Usage: tools {start|status|stop|restart}" | |
exit 3 | |
;; | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment