I haven''t seen my mailing list request confirmed. Please CC me your responses - thanks! Does anyone have a working upstart init script for unicorn? I''ve been trying to write my own, but this is non trivial since USR2 ultimately changes the PPID of the running unicorn instance. 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. Thanks! Josh _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
On 8/10/13, Josh Sharpe <josh.m.sharpe@gmail.com> 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 - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
Josh Sharpe <josh.m.sharpe@gmail.com> wrote:> I haven''t seen my mailing list request confirmed. Please CC me your > responses - thanks!Done! (I think the confirmation should''ve gone through, Rubyforge has been acting funny...). Anyways it''s common practice on many FOSS mailing lists to Cc: all parties (but not Ruby-related lists, unfortunately...)[1]> Does anyone have a working upstart init script for unicorn? I''ve been > trying to write my own, but this is non trivial since USR2 ultimately > changes the PPID of the running unicorn instance.There''s been some talk of it if you search the mailing list archives for links. I get all the modern init replacements mixed up with each other :x> 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.I posted this the other day but haven''t gotten much feedback on it: http://mid.gmane.org/20130724031151.GA14534@dcvr.yhbt.net [1] Fwiw, I prefer Cc: to all anyways. It''s easier to rope in folks for issues that aren''t isolated to the project at hand. _______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying
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 <375gnu@gmail.com> wrote:> On 8/10/13, Josh Sharpe <josh.m.sharpe@gmail.com> 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 - mongrel-unicorn@rubyforge.org > http://rubyforge.org/mailman/listinfo/mongrel-unicorn > Do not quote signatures (like this one) or top post when replying_______________________________________________ Unicorn mailing list - mongrel-unicorn@rubyforge.org http://rubyforge.org/mailman/listinfo/mongrel-unicorn Do not quote signatures (like this one) or top post when replying