diff options
author | Florian Pritz <bluewind@xinu.at> | 2024-10-14 21:37:35 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2024-10-14 21:54:03 +0200 |
commit | 7eac578bab0fa901975fca3bacac61c904cf480c (patch) | |
tree | e456efab8f3660c8d9a86689610399f8f8b86e27 /screen-locker.sh | |
parent | 25ef852543815f8839dda5247c2651f70e597143 (diff) | |
download | bin-7eac578bab0fa901975fca3bacac61c904cf480c.tar.gz bin-7eac578bab0fa901975fca3bacac61c904cf480c.tar.xz |
screen-locker.sh: Add lock to prevent multiple instances
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'screen-locker.sh')
-rwxr-xr-x | screen-locker.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/screen-locker.sh b/screen-locker.sh index 51b6110..b1fb594 100755 --- a/screen-locker.sh +++ b/screen-locker.sh @@ -1,5 +1,12 @@ #!/bin/bash +lock="$HOME/.screen-locker.lck" +exec 9>"${lock}" +if ! flock -n 9; then + logger "screen locker lock already locked" + exit +fi + if pidof i3lock &> /dev/null; then exit 1; fi revert() { |