[rrd-developers] [PATCH] rrdcached can detect (most) stale PID files

kevin brintnall kbrint at rufus.net
Tue Oct 14 23:34:13 CEST 2008

On Tue, Oct 14, 2008 at 11:36:20AM -0700, Bernard Li wrote:
> > Under most circumstances, rrdcached can detect a stale pid file.
> >
> > If the process in the pid file does not exist, or cannot be signalled by
> > the rrdcached owner, then rrdcached will replace the pid file and start
> > normally.  Otherwise, it will complain verbosely to STDERR.
> With the current init script for rrdcached, I have added code to
> cleanup the pidfile.  WIth your patch, is this no longer necessary?
> http://oss.oetiker.ch/rrdtool-trac/browser/trunk/program/etc/rrdcached-init

Your script only cleans up the pid file on clean exit with the rc script.
The daemon already cleans up the pid file on clean exit (via rc script or
otherwise).  There's no harm in an extra unlink() in the rc script, but
it's not necessary.

The new patch attempts to discern (on startup) whether an existing PID
file is the result of a system/daemon crash or whether there is really a
daemon running.  It can't make this decision perfectly, but it's better
than nothing... and it tells you when it fails.

 kevin brintnall =~ /kbrint at rufus.net/

More information about the rrd-developers mailing list