I like the unicorn_forever idea, but as it's lightly tested, I
continued down the path of trying to hack upstart into compliance and
came up with this... Might as well share.
This works nicely when USR2 is received, and restarts the master if
for whatever reason it dies.
Cheers!
$ cat /etc/init/unicorn.conf
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
On Sat, Aug 10, 2013 at 2:20 AM, Hleb Valoshka <[email protected]> wrote:
> On 8/10/13, Josh Sharpe <[email protected]> wrote:
>> I'm thinking a a wrapper script maybe required that stays running even
>> in the event of USR2 to being sent to unicorn, and only dies if the
>> process identified in the PID file is missing.
>
> https://rubyforge.org/pipermail/mongrel-unicorn/2013-July/001820.html
> _______________________________________________
> Unicorn mailing list - [email protected]
> http://rubyforge.org/mailman/listinfo/mongrel-unicorn
> Do not quote signatures (like this one) or top post when replying
_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying