Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!uflorida!novavax!infocenter!mhoffman From: mhoffman@infocenter.UUCP (Mike Hoffman) Newsgroups: comp.unix.questions Subject: Re: Summary - How to tell if a process is active Message-ID: <3080@infocenter.UUCP> Date: 30 Jun 89 19:21:04 GMT References: <763@ctisbv.UUCP> Organization: Gould CSD, Fort Lauderdale, FL Lines: 23 in article <763@ctisbv.UUCP>, pim@ctisbv.UUCP (Pim Zandbergen) says: > > But as our application is mainly turnkey based, I have seen more > then once that checking the pid only is not enough. Our customers > turn on the machine, and go right away into the application. > At that time a resource is being claimed. Then there is a system crash, > the system is rebooted, and the application is restarteds, > AND IS RUNNING WITH THE EXACT SAME PID! Hence, when it finds > the lockfile, it checks for its pid and finds out it exists, > and fails to claim the resource. The second time the application > is started it will continue without failure. This is essentially the same as my application, which provoked my original question. The lockfiles I use, however, are monitored by a daemon process, started by /etc/rc.local at boot time. The first thing my daemon process does is "cleandir()" - remove all lockfiles in the given directory. After that, any processes that start up do so with a clean slate. I a daemon won't suffice, how about a simple shellscript run from /etc/rc.local that cleans up the directories before going multi- user?