Skip to content

@simonoff /gist:750379
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
unicorn init script
#!/bin/sh
### 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
DAEMON=/usr/local/bin/unicorn_rails
DAEMON_OPTS="-c /path/to/unicorn.conf.rb -E production -D"
NAME=unicorn_rails
DESC=unicorn_rails
PID=/path/to/unicorn.pid
OLDPID="$PID.oldbin"
sig () {
test -s "$PID" && kill -$1 `cat $PID`
}
oldsig () {
test -s $OLDPID && kill -$1 `cat $OLDPID`
}
case "$1" in
start)
echo -n "Starting $DESC: "
$DAEMON $DAEMON_OPTS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
sig QUIT
echo "$NAME."
;;
restart)
echo -n "Restarting $DESC: "
sig QUIT
sleep 1
$DAEMON $DAEMON_OPTS
echo "$NAME."
;;
reload)
echo -n "Reloading $DESC code: "
sig USR2
echo "$NAME."
;;
reopen-logs)
echo -n "Reopening $DESC logs: "
sig USR1
echo "$NAME."
;;
*)
echo "Usage: $NAME {start|stop|restart|reload|reopen-logs}" >&2
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.