Created
March 4, 2013 12:05
-
-
Save yono/5081843 to your computer and use it in GitHub Desktop.
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 | |
# | |
# 2nd_gig | |
# | |
# description: start, stop, restart 2nd_gig (Github IRC Gateway) | |
# | |
NAME=gig | |
USER=yono | |
DIR=/home/$USER/servers/2nd_gig | |
PROG=bin/2nd_gig | |
PIDFILE=/var/run/$NAME.pid | |
RBENV_ROOT=/home/$USER/.rbenv | |
RBENV_VERSION="1.9.3-p385" | |
export RBENV_VERSION | |
PATH=$RBENV_ROOT/shims:$RBENV_ROOT/bin:$PATH | |
eval "$(rbenv init -)" | |
start() { | |
echo -n "Starting: $NAME " | |
start-stop-daemon \ | |
--start \ | |
--pidfile $PIDFILE \ | |
--make-pidfile \ | |
--background \ | |
--chdir $DIR \ | |
--user $USER \ | |
--chuid $USER \ | |
--exec $RBENV_ROOT/shims/bundle -- exec $PROG --server 0.0.0.0 --port 16705 | |
return $? | |
} | |
stop() { | |
echo -n "Stopping: $NAME" | |
start-stop-daemon \ | |
--stop \ | |
--oknodo \ | |
--pidfile $PIDFILE | |
return $? | |
} | |
restart() { | |
stop | |
start | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart}" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment