Subject: Re: Should programs clean-up their /var/run/*.pid files?
To: Paul Goyette <email@example.com>
From: Andrew Brown <firstname.lastname@example.org>
Date: 06/06/1997 12:04:21
>Right now, I'm using:
> if [ `ps -ax | grep -c " xntpd " -gt 1 ]; ...
>to detect if xntpd is still running, but that isn't a very reliable way to
>do it (ie, what if some user passed " xntpd " as an argument to their own
>program?). Anyone got any better ideas? Or should xntpd be fixed to
>remove its .pid file?
if ( kill -0 `cat /var/run/xntpd.pid` 2>/dev/null ); ...
will tell you if something is running with that pid which will
probably be xntpd (unless xntp has died and that particular pid has
been recycled and you happen to catch it).
|-----< "CODE WARRIOR" >-----|
email@example.com (TheMan) * "ah! i see you have the internet
firstname.lastname@example.org that goes *ping*!"
email@example.com * "information is power -- share the wealth."