M
Michele Dondi
I want to implement a locking system for a script that shouldn't allow
more than one instance on each machine of a cluster by means of a
lockfile. The relevant code snippet is:
my $lockfile = "$lockdir/$pfx-$host";
sysopen my $lock, $lockfile, O_CREAT | O_EXCL
or die "$0 already running on $host";
Now I'm aware that file operations on nfs are not atomic, but this is
not a big issue since *in this case* the probability of collisions if
ridiculously small.
However it seems that I have another problem, and a more serious one.
Namely the lockfile is actually created in the specified directory,
but it is named .nfs* (I mean, it matches that wildcard...)
Am I missing something obvious? Any workaround/alternative strategy?
TIA
Michele
more than one instance on each machine of a cluster by means of a
lockfile. The relevant code snippet is:
my $lockfile = "$lockdir/$pfx-$host";
sysopen my $lock, $lockfile, O_CREAT | O_EXCL
or die "$0 already running on $host";
Now I'm aware that file operations on nfs are not atomic, but this is
not a big issue since *in this case* the probability of collisions if
ridiculously small.
However it seems that I have another problem, and a more serious one.
Namely the lockfile is actually created in the specified directory,
but it is named .nfs* (I mean, it matches that wildcard...)
Am I missing something obvious? Any workaround/alternative strategy?
TIA
Michele