Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Re: Locking files

by claree0 (Hermit)
on Aug 11, 2001 at 03:10 UTC ( #104072=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Locking files
in thread Locking files

Ras,

Assuming that you are doing this on some sort of unix-like OS, then grepping the output of `ps ax | grep program.pl | wc -l` ought to give you the current number of running processes from that program. If 1 then it is the only instance. If 2 then another is already running, and you can exit the new instance.

There may be a better way of doing this without making calls outside perl - I still talk 'perl baby-talk' quite a lot!

Clare

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://104072]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2022-09-27 16:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (122 votes). Check out past polls.

    Notices?