Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mrsinguyen
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrsinguyen/2f5c2f597984480bb190 to your computer and use it in GitHub Desktop.
Save mrsinguyen/2f5c2f597984480bb190 to your computer and use it in GitHub Desktop.
tools.sh
#!/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