Created
April 5, 2013 11:48
-
-
Save jeevandongre/5318700 to your computer and use it in GitHub Desktop.
Unicorn init.d script for ubuntu 12.04 ec2 instance
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 | |
PATH=/home/ubuntu/.rvm/gems/ree-1.8.7-2012.02/bin:/home/ubuntu/.rvm/gems/ree-1.8.7-2012.02@global/bin:/home/ubuntu/.rvm/rubies/ree-1.8.7-2012.02/bin:/home/ubuntu/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin | |
DAEMON=/home/ubuntu/.rvm/gems/ree-1.8.7-2012.02/bin/unicorn_rails | |
GEM_HOME=/home/ubuntu/.rvm/gems/ree-1.8.7-2012.02 | |
GEM_PATH=ome/ubuntu/.rvm/gems/ree-1.8.7-2012.02:/home/ubuntu/.rvm/gems/ree-1.8.7-2012.02@global | |
DAEMON_OPTS="-D -c /path/to/app/config/unicorn.rb" | |
NAME=unicorn_rails | |
DESC=unicorn_rails | |
PID=/path/to/app/pids/unicorn.pid | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
exec $DAEMON $DAEMON_OPTS | |
echo "$NAME." | |
;; | |
stop) | |
echo -n "Stopping $DESC: " | |
kill -QUIT `cat $PID` | |
echo "$NAME." | |
;; | |
restart) | |
echo -n "Restarting $DESC: " | |
kill -QUIT `cat $PID` | |
sleep 1 | |
$DAEMON $DAEMON_OPTS | |
echo "$NAME." | |
;; | |
reload) | |
echo -n "Reloading $DESC configuration: " | |
kill -HUP `cat $PID` | |
echo "$NAME." | |
;; | |
*) | |
echo "Usage: $NAME {start|stop|restart|reload}" >&2 | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment