Created
November 10, 2013 05:21
-
-
Save cfedde/7394148 to your computer and use it in GitHub Desktop.
flocking the data handle.
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 Fcntl ':flock'; # import LOCK_* constants | |
unless ( flock DATA, LOCK_EX | LOCK_NB ) { | |
print STDERR "Found duplicate script run. Stopping\n"; | |
exit(0); | |
} | |
... | |
__DATA__ | |
This exists to allow the locking code at the beginning of the file to work. | |
DO NOT REMOVE THESE LINES! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment