Tag Archives: perl

Only one Perl instance – lock script

Use File::NFSLock to get an exclusive lock on the script itself: use Fcntl qw(LOCK_EX LOCK_NB); use File::NFSLock; # Try to get an exclusive lock on myself. my $lock = File::NFSLock->new($0, LOCK_EX|LOCK_NB); die “$0 is already running!\n” unless $lock; Alternatively use … Continue reading

Posted in Others | Tagged | Leave a comment