executing code when unicorn worker is SIGKILLed

Eric Wong normalperson at yhbt.net
Wed Sep 26 22:27:23 UTC 2012

Martin Sarsale <martin at malditainternet.com> wrote:
> Dear all:
> I would like to execute some code when the Unicorn worker is killed
> with SIGKILL (ie, incrementing a counter in graphite), what's the
> "nice" way to do this?
> E, [2012-09-26T17:51:47.776065 #28499] ERROR -- : worker=4 PID:28520
> timeout (61s > 60s), killing
> E, [2012-09-26T17:51:47.785081 #28499] ERROR -- : reaped
> #<Process::Status: pid 28520 SIGKILL (signal 9)> worker=4
> I, [2012-09-26T17:51:47.786659 #29010]  INFO -- : worker=4 spawned pid=29010
> I, [2012-09-26T17:51:47.786994 #29010]  INFO -- : Refreshing Gem list

I'm not sure about "nice" :)  I just go with:

  tail -F /path/to/log | script-which-reads-from-stdin

I use tail from GNU coreutils for -F.  Newer coreutils uses inotify on
Linux, too.  I prefer using an external script since I can use a
different language and also update it freely without redeploying the

> ps: thanks for unicorn, it feels great.

You're welcome :)

More information about the mongrel-unicorn mailing list