[Mongrel] Why not ignore stale PID files?

Istvan Szukacs leccine at gmail.com
Fri Jun 6 14:48:44 EDT 2008


kill -0 `cat pid_file` >& /dev/null

more like

kill -0 $(<pid_file) >& /dev/null

regards,
Istvan

Erik Hetzner wrote:
> At Thu, 5 Jun 2008 16:08:06 -0500,
> Gunnar Wolf <gwolf at gwolf.org> wrote:
>   
>> Hi,
>>
>> I have an application which is dying horrible deaths
>> (i.e. segmentation faults) in mid-flight, in production... And of
>> course, I should fix it. But while I find and fix the bugs, I found
>> something I think should be different - I can work on submitting a
>> patch, as it is quite simple, but I might be losing something on my
>> rationale. 
>>
>> […]
>>     
>
> I use the following bit in my Capistrano scripts before I start
> Mongrel:
>
> ( [ -f pid_file ] && ( kill -0 `cat pid_file` >& /dev/null || rm pid_file ) )
>
> which handles the typical cases (in which no process with a given pid
> is running, or a process is running with a different owner from the
> mongrel owner) but not the edge case where a process is running, with
> the same owner, but is no longer a mongrel process. You could
> supplement this with Linux/Solaris specific stuff to check if the
> process running is actually a mongrel.
>
> best,
> Erik Hetzner
>   
> ------------------------------------------------------------------------
>
> ;; Erik Hetzner, California Digital Library
> ;; gnupg key id: 1024D/01DB07E3
>   
> ------------------------------------------------------------------------
>
> _______________________________________________
> Mongrel-users mailing list
> Mongrel-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mongrel-users



More information about the Mongrel-users mailing list