instance check

instance check

Post by Barry Margoli » Wed, 23 Feb 2000 04:00:00





>Hi,
>    Does anyone know that by which i can check the instance there? Is there
>a better way except for "ps -ef " and "lock a file"?

Another way: When the application starts, it can put its PID into a file.
When another instance starts, if the file already exists it reads the PID
and then checks whether that process exists using kill(pid, 0).

This could get a false positive if the old instance died and the PID got
reused by something else.

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.