Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 67 lines (61 sloc) 1.171 kB
#!/usr/bin/env bash
DIR=$(dirname $(readlink -f $0)) # Directory script is in
SCRIPT=$DIR/$(basename $0)
function running(){
if [ -f "$DIR/pidfile" ]; then
if [ "$(ps aux | grep -i $(cat pidfile) | grep -v grep)" != "" ]; then
true
else
rm $DIR/pidfile
status
fi
else
false
fi
}
function status(){
echo -n "XRasp server is ";
if [ !running ]; then
echo -n "not ";
fi
echo "running."
}
function finish(){
if [ "$?" == "0" ]; then
echo "[DONE]"
else
echo "[FAIL]"
fi
}
case "$1" in
"stop")
if running; then
echo -n "Stopping XRasp server...."
kill $(cat pidfile)
rm pidfile
finish
else
echo "XRasp server not running."
fi
;;
"start")
if [ -f "$DIR/pidfile" ]; then
echo "XRasp server already running, perhaps you meant \`$0 restart\`?"
else
echo -n "Starting XRasp server..."
$DIR/server.rb &> /dev/null &
echo $! > $DIR/pidfile
finish
fi
;;
"restart")
$SCRIPT stop --silent
$SCRIPT start --silent
;;
"status")
status
;;
*)
echo "Usage: $0 (start|stop|restart|status|help)"
;;
esac
Jump to Line
Something went wrong with that request. Please try again.