RE: how to make sure, that the script is running one time?
From: Bob Showalter (Bob_Showalter_at_taylorwhite.com)
Date: 03/12/04
- Next message: James Edward Gray II: "Re: how to make sure, that the script is running one time?"
- Previous message: Stuart White: "Re: help with a regex and greediness"
- Maybe in reply to: Christian Stalp: "how to make sure, that the script is running one time?"
- Next in thread: James Edward Gray II: "Re: how to make sure, that the script is running one time?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
To: "'stalp@imbei.uni-mainz.de'" <stalp@imbei.uni-mainz.de>, beginners@perl.org Date: Fri, 12 Mar 2004 10:32:36 -0500
Christian Stalp wrote:
> Hello together,
> I have a question regarding process-control. I want to write a perl
> script which must not running in more than one process in the same
> time. The script creates a directory copys a zip-file in it, unpack
> it and reads every file in this package. However, the files must not
> get opened by another process.
Are you extracting the files just to read through them? Why not just extract
to a pipe and read the data from that? Then you can avoid creating the files
in the first place?
> How can I make sure, that my perl-scipt runs only in one process
This is typically done by acquiring a lock on a file (usually a "pid" file
that contains the process id number). There's a Proc::PID::File module on
CPAN that looks pretty neat, though I haven't used it personally.
> , or
> eaysier, is there a function "flock" which blocks a whole directory
> and not only a single file?
Not really a way to do that with a lock, and locks are "advisory" only,
depending on your O/S. You might want to play with directory permissions...
- Next message: James Edward Gray II: "Re: how to make sure, that the script is running one time?"
- Previous message: Stuart White: "Re: help with a regex and greediness"
- Maybe in reply to: Christian Stalp: "how to make sure, that the script is running one time?"
- Next in thread: James Edward Gray II: "Re: how to make sure, that the script is running one time?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|