Created
January 27, 2021 04:49
-
-
Save salah93/702b546771d14c3c52a98b64b4f18d71 to your computer and use it in GitHub Desktop.
scripts with locking
This file contains 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 | |
set -xeuo pipefail | |
( | |
flock -s -w 6 200 | |
cat /tmp/x | |
echo read | |
sleep 5 | |
) 200>/tmp/pidlock |
This file contains 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 | |
set -xeuo pipefail | |
( | |
flock -w 6 200 | |
echo "abc" > /tmp/x | |
echo write | |
sleep 5 | |
) 200>/tmp/pidlock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment