From: Alain Spineux Date: Mon, 17 Jan 2022 17:30:57 +0000 (+0100) Subject: regress: combine inotifywait and timeout to detect delete event X-Git-Tag: Beta-15.0.0~672 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54d09c96b8fa59d57989489a46f86bebe9346dd0;p=thirdparty%2Fbacula.git regress: combine inotifywait and timeout to detect delete event - it looks like inotify could miss some event --- diff --git a/regress/scripts/blab.py b/regress/scripts/blab.py index cca5e300d..a7426b470 100755 --- a/regress/scripts/blab.py +++ b/regress/scripts/blab.py @@ -661,7 +661,11 @@ class Lab: f.write("""\ # The plugin unlink the file just after open() # echo "$$ `date` $@" >> /tmp/log -while [ -f {tmp}/dedupstreams.conf ] ; do sleep 1; done + +# if inotifywait is installed then use it to "instantly" detect that the file +# as been deleted from the direcory (aka "consumed") else wait 1s +wait_cmd="`which inotifywait` -t 5 -e delete {tmp}" || wait_cmd="sleep 1" +while [ -f {tmp}/dedupstreams.conf ] ; do $wait_cmd; done for var in "$@" ; do if [ "${{var}}" = "next" ] ; then var=0