Created
July 1, 2011 12:52
-
-
Save brandonhilkert/1058482 to your computer and use it in GitHub Desktop.
Unicorn startup script
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 | |
# File: /etc/init.d/unicorn | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the unicorn web server | |
# Description: starts unicorn | |
### END INIT INFO | |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
DAEMON=/usr/local/rvm/gems/ruby-1.9.2-p180/bin/unicorn | |
DAEMON_OPTS="-c /vol/data/rails/meeteor_production/current/unicorn.rb -E production -D" | |
NAME=unicorn | |
DESC="Unicorn app for meeteor" | |
PID=/vol/data/rails/meeteor_production/shared/pids/unicorn.pid | |
case "$1" in | |
start) | |
echo -n "Starting $DESC: " | |
$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