Hi There, I use below code to make sure i have only one instance of my script running at a time. But weirdly enough i sometimes seem to have running two instances. This script is getting called on a regular basis by a cron job and may take a long time (30+min)to complete but still...I can't figure out what would be wrong with this code, anyone?
#[PID] #Check if PID file already exists if ( -s $PIDloc){ print "THERE IS ALREADY AN INSTANCE OF UPDATESERVER RUNNING\n check \"".$PIDloc."\"\n"; syslog('info',"THERE IS ALREADY AN INSTANCE OF UPDATESERVER RUNNING \n check \"".$PIDloc."\""); exit(999); } #if it doesn't exist, create it (gets ereased atr the bottom of MAIN on completion) my $pid = $$; open my $fd,'>', $PIDloc or die $!; print $fd $pid; close $fd or die $!; #[/PID] Thanks for any hints or suggestions! Ron PS $PIDloc is srt to "/var/run/UpdtSrv.pid" -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/