diff options
Diffstat (limited to 'watch-calendars')
-rwxr-xr-x | watch-calendars | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/watch-calendars b/watch-calendars index cf9eb21..0c74f89 100755 --- a/watch-calendars +++ b/watch-calendars @@ -1,6 +1,16 @@ #!/bin/bash +lock_file=/tmp/watch-calendars.lock + if [ $# -eq 0 ]; then + if [ -r "${lock_file}" ] \ + && kill -0 "$(cat "${lock_file}")"; then + exit + fi + + echo $$ >"${lock_file}" + trap 'rm "${lock_file:?}"' EXIT + find ~/.local/share/khal/calendars \ -mindepth 1 \ -maxdepth 1 \ |