Do not sleep initially in oneshot mode

This commit is contained in:
Chris Down 2017-05-10 10:05:16 +01:00
parent 3ab7a6e2e7
commit e7a15a5d50

View file

@ -60,7 +60,7 @@ declare -A last_filename
exec {lock_fd}> "$lock_file" exec {lock_fd}> "$lock_file"
while sleep "${CM_SLEEP:-0.5}"; do while (( CM_ONESHOT )) || sleep "${CM_SLEEP:-0.5}"; do
if ! flock -x -w "$lock_timeout" "$lock_fd"; then if ! flock -x -w "$lock_timeout" "$lock_fd"; then
if (( CM_ONESHOT )); then if (( CM_ONESHOT )); then
printf 'ERROR: %s\n' 'Timed out waiting for lock' >&2 printf 'ERROR: %s\n' 'Timed out waiting for lock' >&2