Subject: Re: Should programs clean-up their /var/run/*.pid files?
To: Paul Goyette <firstname.lastname@example.org>
From: Andrew Brown <email@example.com>
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" >-----|
firstname.lastname@example.org (TheMan) * "ah! i see you have the internet
email@example.com that goes *ping*!"
firstname.lastname@example.org * "information is power -- share the wealth."