Subject: Re: Should programs clean-up their /var/run/*.pid files?
To: Paul Goyette <>
From: Andrew Brown <>
List: current-users
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/` 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).

much cleaner...

|-----< "CODE WARRIOR" >-----| (TheMan)        * "ah!  i see you have the internet                               that goes *ping*!"      * "information is power -- share the wealth."