Re: How can I tell if another instance is already running?

From: base60 (nobody_at_whitehouse.com)
Date: 10/30/05


Date: Sun, 30 Oct 2005 14:43:57 GMT

jt wrote:
> Using C to write an application, and trying to come up with a way on to
> detect if the same application which is running already.
>
> Any ideas how I can approach this in C, to check if another instance is
> already running?

Define a temporary pid file and a permanent pid file.

Write the pid to the temp file.

Check if the permanent exists, if not, link the two
and keep going.

If it does, check to see if the pid in the permanent
file is active, if true, exit. If false, link the
two and keep going.



Relevant Pages