Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Re: Locking files

by Ras (Acolyte)
on Aug 10, 2001 at 17:03 UTC ( [id://103857]=note: print w/replies, xml ) Need Help??


in reply to Re: Locking files
in thread Locking files

I don't understand what you mean claree0. Can you show me some kind of example. thanks.

Replies are listed 'Best First'.
Re: Re: Re: Locking files
by claree0 (Hermit) on Aug 11, 2001 at 03:10 UTC
    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://103857]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-03-28 22:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found