Date: Tue, 23 Mar 1999 21:54:52 +1000 From: Greg Black <gjb@comkey.com.au> To: cjclark@home.com Cc: freebsd-questions@FreeBSD.ORG (FreeBSD Questions) Subject: Re: Process Checking Message-ID: <19990323115452.12503.qmail@alpha.comkey.com.au> In-Reply-To: <199903230637.BAA10035@cc942873-a.ewndsr1.nj.home.com> of Tue, 23 Mar 1999 01:37:19 EST References: <199903230637.BAA10035@cc942873-a.ewndsr1.nj.home.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> Is there a more reliable and graceful way to check if a process, > identified by pid, is still alive? The standard way to do this from a shell script is: kill -0 $pid || restart_daemon There's a small risk that the pid has been re-cycled and is in use by some other process, but that's a race that you have to manage in any other solution anyway. Obviously, there's also a trivial C idiom for this, but I think you wanted something for a script. There are much better methods if you have source to the flaky daemon, but I'll leave them as an exercise with the atexit(3) or flock(2) man pages. -- Greg Black <gjb@acm.org> To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990323115452.12503.qmail>