Created
July 27, 2012 13:40
Revisions
-
witscher created this gist
Jul 27, 2012 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ description "Unicorn" # starting unicorn with bundler, and a user contained rvm: start on filesystem or runlevel [2345] stop on runlevel [!2345] chdir /path/to/current env RAILS_ENV=production # as the unicorn master detaches itself (and you probably want to restart it safely with capistrano), a working solution is to use the pre-start and post-stop flags: pre-start script exec su - <app-user> -c "cd /path/to/current; source ~/.rvm/scripts/rvm; ~/.rvm/bin/rvm-shell -c 'bundle exec unicorn -c config/unicorn.rb -E production -D'" end script post-stop exec kill `cat /path/to/unicorn.pid`