Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-20-2004, 08:35 PM   #1
Registered: May 2003
Posts: 256

Rep: Reputation: 30
Question /var/run/[XXX].pid - Tcl pid code

I wish to implement capturing my pid to be stored in /var/run.

Has anyone done this in Tcl?

Can I please have some sample code?

By using this file, /var/run/[xxx].pid, is this the best way to determine if an istance of your application is already running? Once again, any sample code?

Please advise.
Old 05-20-2004, 10:32 PM   #2
Registered: May 2003
Posts: 256

Original Poster
Rep: Reputation: 30
Question pid code

I think I got it...


if { [ file exists /var/run/ ] == 1 } {
if { [ catch { exec ps h [ exec cat /var/run/ ] } ] == 0 } {
# APP Process is already running, exit
puts "APP process is already running"
} else {
# Remove old pid file, create new pid file
exec rm /var/run/
exec echo [ pid ] > /var/run/
} else {
# create new pid file
exec echo [ pid ] > /var/run/

Any comments are appreciated.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
no pid file in /var/run for programs wolfe2554 Linux - Software 5 01-01-2007 12:02 AM
rm cannot remove /var/run/ and /var/run/ danishmr Linux - Software 1 05-04-2004 08:01 AM
Apache: child pid XXX exit signal Segmentation fault (11) gabriele_101 Linux - Hardware 1 07-23-2003 06:12 PM
can't lock /var/run/ robeb Linux - General 0 06-08-2002 12:26 PM
cannot write PID to var/run/news cruella Linux - Newbie 1 01-22-2002 06:51 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:42 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration