Skip to content

Instantly share code, notes, and snippets.

@m3nd3s
Created August 12, 2013 12:32
Show Gist options
  • Save m3nd3s/6210443 to your computer and use it in GitHub Desktop.
Save m3nd3s/6210443 to your computer and use it in GitHub Desktop.
Upstart Script for Unicorn
description "Unicorn configuration"
start on filesystem
stop on shutdown
respawn
kill signal QUIT
script
start-stop-daemon --start --chuid blue --chdir
/u/apps/blue-test-app/current --exec /usr/bin/bundle exec
unicorn_rails -- -c /u/apps/blue-test-app/shared/system/unicorn.cfg -E
production
exists=0
pidfile=/tmp/unicorn.master.pid
oldpidfile=/tmp/unicorn.master.pid.oldbin
while [ $exists -eq 0 ]
do
sleep 0.1
(test -f $pidfile && pgrep -P $(cat $pidfile)) || (test -f
$oldpidfile && pgrep -P $(cat $oldpidfile))
exists=$?
done
exec rm /tmp/unicorn.master.pid
exec rm /tmp/unicorn.master.pid.oldbin
exit 1
end script
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment