Summary - How to tell if a process is active
David Goodenough
dg at lakart.UUCP
Fri Jun 23 23:48:15 AEST 1989
>From article <763 at ctisbv.UUCP>, by pim at ctisbv.UUCP (Pim Zandbergen):
] 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.
]
] So I am looking for some way to put some extra information into
] the lockfile to find out if the machine has been rebooted
] since the resource claim. What is the most obvious and portable
] way to do this?
Why not just give the lock files a generic name -
/usr/spool/lock/XXresource
or somesuch. Now do a:
rm -f /usr/spool/lock/XX*
in your /etc/rc (or /etc/rc.local if you have a civilized system)
and you're all set: the lockfiles all vanish every time the system
comes up.
--
dg at lakart.UUCP - David Goodenough +---+
IHS | +-+-+
....... !harvard!xait!lakart!dg +-+-+ |
AKA: dg%lakart.uucp at xait.xerox.com +---+
More information about the Comp.unix.questions
mailing list