Summary - How to tell if a process is active

Mike Hoffman mhoffman at infocenter.UUCP
Sat Jul 1 05:21:04 AEST 1989


in article <763 at ctisbv.UUCP>, pim at 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?



More information about the Comp.unix.questions mailing list