Tip: How to prevent multiple instances of the same script ?
Posted: August 23rd, 2010 | Author: Pedro A. | Filed under: Perl | No Comments »<code>#!/usr/bin/perl 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; </code>

Leave a Reply