monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [monit] empty pidfile


From: Dan Urist
Subject: Re: [monit] empty pidfile
Date: Tue, 29 Dec 2009 14:59:05 -0700

On Tue, 29 Dec 2009 20:12:47 +0100
Martin Pala <address@hidden> wrote:

> In this case monit should restart the process - can you try to run it
> with -v option?:
> 
>   monit -vI
> 
> I think the problem could be that the startup script which is called
> by monit exits when it finds existing pidfile. 

On further investigation, it seems that monit can handle a start action
correctly with an empty pidfile, but not a stop action. This is where
I'm getting the "pidfile does not exist" error, and the init script is
never being run (I checked the init script; it just does a pkill
without looking at the pidfile).

> As workaround you can either modify the program startup script to
> handle empty pidfile or set monit test to do so:
> 
>   check file /var/run/myprocess.pid
>     if size = 0 then exec "/bin/rm /var/run/myprocess.pid"

That doesn't seem to work if the pidfile has disappeared and then monit
tries to stop the process; i.e. the monit stop action will fail if the
pidfile is missing.

I realize the real issue here is the bad behavior of the daemon
(php-cgi), but I don't have an easy way to fix that.

> 
> Regards,
> Martin
> 
> 
> On Dec 29, 2009, at 7:29 PM, Dan Urist wrote:
> 
> > I have a daemon process I'm trying to monitor that will occasionally
> > die uncleanly, leaving behind a zero-length pidfile. When this
> > happens, monit logs "Error reading pid from file" and won't attempt
> > to restart the process. Since monit never runs the init script for
> > the daemon, there is no way to clean up the zero-length pidfile. Is
> > there any workaround for this? I'm using monit v. 5.0.3.
> > 
> > -- 
> > Dan Urist
> > address@hidden
> > 303-497-2459
> > 
> > 
> > --
> > To unsubscribe:
> > http://lists.nongnu.org/mailman/listinfo/monit-general
> 
> 
> 
> --
> To unsubscribe:
> http://lists.nongnu.org/mailman/listinfo/monit-general



-- 
Dan Urist
address@hidden
303-497-2459




reply via email to

[Prev in Thread] Current Thread [Next in Thread]