Created
March 19, 2009 15:42
-
-
Save newbamboo/81885 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# Startup script for a Panda encoder. | |
PORT=5000 | |
MERB_ROOT="/var/www/panda/current" | |
PID_FILE="$MERB_ROOT/log/merb.encoder.pid" | |
RETVAL=0 | |
# Go no further if merb app conf is gone | |
[ -a "$MERB_ROOT" ] || exit 0 | |
start() | |
{ | |
cd $MERB_ROOT && merb -u panda -G panda -n encoder.$PORT -e encoder -P $PID_FILE -p $PORT -r bin/encoder.rb -d | |
RETVAL=$? | |
echo -n "Starting Panda encoder:" | |
if [ "$RETVAL" -ne 0 ] | |
then | |
echo " [ FAIL ]" | |
else | |
echo " [ OK ]" | |
fi | |
} | |
stop() | |
{ | |
kill -s INT `cat $PID_FILE` | |
RETVAL=$? | |
echo -n "Stopping Panda encoder:" | |
if [ "$RETVAL" -ne 0 ] | |
then | |
echo " [ FAIL ]" | |
else | |
echo " [ OK ]" | |
fi | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
sleep 2 | |
start | |
;; | |
*) | |
echo "Usage: (start|stop|restart)" | |
exit $RETVAL | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment