Re: [LIP] check instance of a running application

Shridhar Daithankar <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Organization Persistent Systems Pvt. Ltd.
Message-ID <[email protected]>
Binand Sethumadhavan wrote:
> On Wed, Dec 24, 2003 at 04:45:43AM -0800, Ram wrote:
> 
>>For checking whether app is still running , I tried by
>> writing the  PID value to a file and later checked
>>whether it exists or not. is there any other way to do
>>this....
> 
> 
> Your method is fine. On startup, log the PID in a file somewhere. To
> check if the application is running or not, use kill().

Rather than writing pid file, you can attach to a shared memory segment and 
write ID of that segment to file. That way the information can be passed between 
instances even if one instance died much before start of next instance..

  Just another approach..

  Shridhar


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.