Skip to content

Instantly share code, notes, and snippets.

@elnatnal
Created March 21, 2013 18:54
Show Gist options
  • Select an option

  • Save elnatnal/5215646 to your computer and use it in GitHub Desktop.

Select an option

Save elnatnal/5215646 to your computer and use it in GitHub Desktop.
Random gist help
use 5.14.2;
use warnings;
use IPC::ConcurrencyLimit;
run();
exit(0);
sub run {
my $limit = IPC::ConcurrencyLimit->new(
max_procs => 1,
path => '/var/run/myapp',
);
my $id = $limit->get_lock;
if (not $id) {
warn "Another process appears to be still running. Exiting.";
exit(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment