Created
March 21, 2013 18:54
-
-
Save elnatnal/5215646 to your computer and use it in GitHub Desktop.
Random gist help
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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