Created
December 1, 2020 14:58
-
-
Save tacone/453eed35f0cc23a766082883828121ac to your computer and use it in GitHub Desktop.
How to use file locking
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
#!/bin/bash | |
# will wait | |
flock -n /tmp/mycommand.flock mycommand | |
# -n makes it fail rather than wait | |
flock -n /tmp/mycommand.flock mycommand |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment