Created
June 20, 2015 02:25
-
-
Save paulmars/77d2a757ab4f1bc99028 to your computer and use it in GitHub Desktop.
lock a script to run once
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
| unless open(__FILE__).flock(File::LOCK_EX | File::LOCK_NB) | |
| puts "script already running..." | |
| exit | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment