http://www.perlmonks.org?node_id=1025625


in reply to Re: Ensuring only one copy of a perl script is running at a time
in thread Ensuring only one copy of a perl script is running at a time

What about?

$cmd = 'ps -eaf | grep -c "\< '."$0".'\>"'; chomp($instances = `$cmd`); if($instances > 1) exit;
  • Comment on Re^2: Ensuring only one copy of a perl script is running at a time
  • Download Code