On Fri, Nov 28, 2008 at 00:09, Anirban Adhikary
<[EMAIL PROTECTED]> wrote:
snip
> my $lock_file="/home/bighosh/OraOneLoader_3.0.2/Source/flocktest.txt";
> open LOCKFILE, ">>$lock_file" or die "Cannot open $lock_file $!";
>
> while( )
> {
> unless (flock LOCKFILE, LOCK_EX|LOCK_NB) {
> warn "File $lo
On Mon, Mar 17, 2008 at 4:47 PM, Dermot <[EMAIL PROTECTED]> wrote:
snip
> print $fh $status."\n";
> print STDERR "$0: $! $?\n";
snip
$? holds the status returned by the last external call (call to
system() function, pipes, qx// operator, call to wait() or waitpid(),
Dermot wrote:
Hi,
Hello,
I have a cgi script that writes to a disk file. It would be safest if I can
get an exclusive lock on the file. I had a look at the opentut and believe I
have followed that the example there. Here's what I have
sysopen my $fh, $file_path, O_WRONLY || die "can't open $
Dermot wrote:
I have a cgi script that writes to a disk file. It would be safest if I can
get an exclusive lock on the file. I had a look at the opentut and believe I
have followed that the example there. Here's what I have
sysopen my $fh, $file_path, O_WRONLY || die "can't open
$
Dermot schreef:
>sysopen my $fh, $file_path, O_WRONLY
>|| die "can't open $file_path: $!\n";
Change or-operator (or use parenthesis).
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
On 6/11/07, oryann9 <[EMAIL PROTECTED]> wrote:
snip
If you use LOCK_NB and are refused a LOCK_SH, then you
know that someone else has a LOCK_EX and is updating
the file. If you are refused a LOCK_EX, then someone
holds either a LOCK_SH or a LOCK_EX, so you shouldn't
try to update the file.
snip
On Wed, 12 Oct 2005 09:55:12 -0400, Tom Allison wrote:
> How do I test for NFS mounting so I can flag it as a problem in my code?
The device number may be negative; try it and see. perldoc -f stat.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
--
To unsubscribe, e-mai
On Oct 13, 2005, at 12:13, Tom Allison wrote:
John Doe wrote:
Tom Allison am Mittwoch, 12. Oktober 2005 15.55:
[...]
Since you got no answer yet from somebody knowing better:
thanks, I'll look into it. I'm at a disadvantage since it is
difficult to install something on this machine. I'm
John Doe wrote:
Tom Allison am Mittwoch, 12. Oktober 2005 15.55:
[...]
Since you got no answer yet from somebody knowing better:
thanks, I'll look into it. I'm at a disadvantage since it is difficult
to install something on this machine. I'm not root.
--
To unsubscribe, e-mail: [EMAIL PRO
Tom Allison am Mittwoch, 12. Oktober 2005 15.55:
[...]
Since you got no answer yet from somebody knowing better:
> How do I test for NFS mounting so I can flag it as a problem in my code?
hand made: examine /proc/mounts ...
But I'm shure there are much better ways.
> What options are there for
- Original Message -
From: bclark1 <[EMAIL PROTECTED]>
Date: Thursday, July 14, 2005 6:48 am
Subject: flock and open files
> Hi list
Hello,
>
> My colleaque and I have just had a small disagreement with each
> other
> about file locking and reading / ammending a txt file.
>
> To up d
Smoot Carl-Mitchell wrote:
On Wed, 07 Apr 2004 14:50:54 -0500
"JupiterHost.Net" <[EMAIL PROTECTED]> wrote:
So flock(FH, LOCK_EX | LOCK_NB) then?
Yes.
So:
my $rc = flock(FH, LOCK_EX | LOCK_NB);
if($rc == 0) { warn "rats! Exclusive lock not granted, oh well..."; }
if(!defined $rc) { die "Co
On Wed, 07 Apr 2004 14:50:54 -0500
"JupiterHost.Net" <[EMAIL PROTECTED]> wrote:
> So flock(FH, LOCK_EX | LOCK_NB) then?
Yes.
> So:
> my $rc = flock(FH, LOCK_EX | LOCK_NB);
>
> if($rc == 0) { warn "rats! Exclusive lock not granted, oh well..."; }
> if(!defined $rc) { die "Could not get lock no
Smoot Carl-Mitchell wrote:
On Wed, 07 Apr 2004 13:51:03 -0500
"JupiterHost.Net" <[EMAIL PROTECTED]> wrote:
perldoc -f flock says
"If LOCK_NB is bitwise-or'ed with LOCK_SH or LOCK_EX then "flock"
will return immediately rather than blocking waiting for the lock
(check the return status to se
On Wed, 07 Apr 2004 13:51:03 -0500
"JupiterHost.Net" <[EMAIL PROTECTED]> wrote:
> perldoc -f flock says
>
> "If LOCK_NB is bitwise-or'ed with LOCK_SH or LOCK_EX then "flock"
> will return immediately rather than blocking waiting for the lock
> (check the return status to see if you got it).
Shaun Fryer wrote:
>
> I'm writing an app which uses a flat file to store a
> *short* list of simple key/value pairs. However having
> read the flock() man page, I'm unsure about whether I
> need to seek() in cases where I'm not merely appending
> to the file (such as when deleting a record).
>
> s
On Mon, 11 Nov 2002, Nisim, Amit wrote:
> Hi All,
>
>
> flock doesn't work when I am running flock to file x from different machines.
>
> What I mean:
> I am running flock from machine XXX on file z
> If I try to write to file z from machine YYY I succeed.
>
>
> Do you know mechanism like fl
Hi,
I posted this message this morning.
Is there anybody who can help?
Thank you
On Wednesday 06 February 2002 10:33, Alain wrote:
> Hi,
>
> I need to use flock function with files on nfs partitions.
> I've read that flock only works with local files, and that perl needs to be
> configured to us
> -Original Message-
> From: Rich Fernandez [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 20, 2001 2:23 PM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: flock problem on AIX 4.3.3
>
>
> Hello,
>
> A colleague is experiencing some problems using user_manage
> v1.53
use Fcntl qw(:flock);
until(flock $fh, LOCK_EX|LOCK_NB)
{
$lockwait++;
if($lockwait == 10)
{
print STDERR "timed out waiting for lock\n";
exit 1;
}
sleep 1;
}
this will do a non-blocking attempt to get the lock, and try 10 t
look in to the alarm() function
perldoc -f alarm
+Pete
--
[EMAIL PROTECTED]
;;($_='Yw_xUabcdtefgdijktljkotiersjkUzxT
yvlkbfdtcierstajogvPruntRshackRJelov')=~
y&/RTUv;wxYz$&/ ~'/;$=();$&&&eval&&print
<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi,
>
> I'
Paul wrote:
>
> One option is to rename the logfile temporarily. Have the script call
> it something like LogTemp$$ or something ($$ is the PID of the current
> job). Then it doesn't *exist* in it's previous name. Move it back to
> the original filename when you're done.
If you have admi
One option is to rename the logfile temporarily. Have the script call
it something like LogTemp$$ or something ($$ is the PID of the current
job). Then it doesn't *exist* in it's previous name. Move it back to
the original filename when you're done.
There are problems with that, too, though, suc
Nichole Bialczyk wrote:
> i'm curious as to how secure flock is. if the file is locked and another
> user tries to access it, does it wait or does it kick them off?
It depends. The main thing to consider is that in general file
locking is a voluntary sort of arrangement. When you use perl's
flock
I was a little confused because you are talking about users in your original
post. If you flock a file and a user can still view it, probably edit it. If
only your scripts are accessing the file then you are pretty safe. At least
that's my understanding.
Peter C.
> i'm trying to lock a log f
i'm trying to lock a log file wheneber a new visitor enters the page and
also when we run scripts to traverse the log file looking for specific info.
On Mon, Jun 04, 2001 at 07:42:38AM -0700, Peter Cornelius wrote:
> According to the docs flock is just an 'advisory' lock. So it only works as
>
On Jun 4, Nichole Bialczyk said:
>i'm curious as to how secure flock is. if the file is locked and another
>user tries to access it, does it wait or does it kick them off? also, is
>it ever possible for it to get stuck?
First, let me tell you that flock() doesn't really produce "file
locking"
--- Nichole Bialczyk <[EMAIL PROTECTED]> wrote:
> i'm curious as to how secure flock is. if the file is locked and
> another user tries to access it, does it wait or does it kick them
> off? also, is it ever possible for it to get stuck?
I think you can set the semantics to wait, or return an im
--- Peter Scott <[EMAIL PROTECTED]> wrote:
> > A rather clever way to emulate locking is to use mkdir() and
> > rmdir().
> > Although it requires you to create a lock file, it's atomic and
> > safe.
> >
> > sub lock {
> > 1 until mkdir "$_[0].lck", 0777;
> > $locked{$_[0]}++;
> > }
On
Jeff .. you wrote ..
>On May 15, King, Jason said:
>
>>>A rather clever way to emulate locking is to use mkdir() and rmdir().
>>>
>>>Although it requires you to create a lock file, it's atomic and safe.
>>
>>are you sure ? .. just because it constitutes one Perl
>statement doesn't
>>mean that i
On May 15, King, Jason said:
>>A rather clever way to emulate locking is to use mkdir() and rmdir().
>>
>>Although it requires you to create a lock file, it's atomic and safe.
>
>are you sure ? .. just because it constitutes one Perl statement doesn't
>mean that it's atomic .. I suspect mkdir has
Brian Shoemaker writes ..
>Starting very soon, we'll be changing from Linux to NT.
>
>Currently, at the beginning of programs I use the following
>use Fcntl qw(:flock);
>then later in the scripts I use
>flock(FILE, LOCK_EX);
>
>The Perl 5 book I have says flock function doesn't work in
>Windows
Jeff Pinyan writes ..
>On May 14, Brian Shoemaker said:
>
>>The Perl 5 book I have says flock function doesn't work in
>Windows systems.
>>
>>I don't want to create a lock file each time someone accesses
>a file and
>>then have to delete that lock.
>
>A rather clever way to emulate locking is
On May 14, Peter Scott said:
>Ooh, that is clever. Has it been encapsulated in a CPAN module?
No. It can break on NFS.
>> 1 until mkdir "$_[0].lck", 0777;
>
>Perhaps sleep 1 until mkdir would be a little less stressful on the average
>system :-)
Feh. ;)
--
Jeff "japhy" Pinyan [EM
At 06:01 PM 5/14/01 -0400, Jeff Pinyan wrote:
>On May 14, Brian Shoemaker said:
>
> >The Perl 5 book I have says flock function doesn't work in Windows systems.
> >
> >I don't want to create a lock file each time someone accesses a file and
> >then have to delete that lock.
>
>A rather clever way
On May 14, Brian Shoemaker said:
>The Perl 5 book I have says flock function doesn't work in Windows systems.
>
>I don't want to create a lock file each time someone accesses a file and
>then have to delete that lock.
A rather clever way to emulate locking is to use mkdir() and rmdir().
Althoug
>-Original Message-
>From: Brian Shoemaker [mailto:[EMAIL PROTECTED]]
>Sent: Monday, May 14, 2001 4:55 PM
>To: [EMAIL PROTECTED]
>Subject: flock
>
>
>Starting very soon, we'll be changing from Linux to NT.
I am so sorry for you. :-)
>Currently, at the beginning of programs I use the foll
I'm just reading in the Perl DBI book about flock. It says it works in
Windows NT/2000, just not on Windows 95/98. That's just what I read, haven't
tested it.
> -Original Message-
> From: Brian Shoemaker [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, May 14, 2001 2:55 PM
> To: [EMAIL PROTECTE
RDWest writes ..
>i just joined the list. i've been fooling with perl scripts for a
>few months now. just installing and editing html output mainly... now
>i'm studying a coupkle books to write my own (i hope)
>
>question: i've seen a couple post in some forums about creating a temp
>file for
39 matches
Mail list logo