From ed1de450240582ce034ee5d0da918c236c3d199f Mon Sep 17 00:00:00 2001 From: makefu Date: Fri, 18 Dec 2015 10:58:15 +0100 Subject: cac: use sleep if always_update instead of inotify --- cac | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cac b/cac index bde47fd..e25c54f 100755 --- a/cac +++ b/cac @@ -13,7 +13,7 @@ cac_resources_cache=${cac_resources_cache-$HOME/tmp/cac_resources_cache.json} cac_servers_cache=${cac_servers_cache-$HOME/tmp/cac_servers_cache.json} cac_tasks_cache=${cac_tasks_cache-$HOME/tmp/cac_tasks_cache.json} cac_templates_cache=${cac_templates_cache-$HOME/tmp/cac_templates_cache.json} - +update_interval=${update_interval-10} cac_secrets=${cac_secrets-$HOME/.secrets/cac} _load_secrets() { @@ -275,9 +275,15 @@ __cac_cli__waitstatus() { ;; esac - echo "$(date -Is) Waiting for status: $2; current status: $status ..." >&2 - - __cac_cli__waitforcacheupdate __cac_cli__waitstatus "$@" + # always_update is not compatible with inotifywait + if test -z "${always_update:-}";then + echo "$(date -Is) Waiting for status: $2; current status: $status ..." >&2 + __cac_cli__waitforcacheupdate __cac_cli__waitstatus "$@" + else + echo "$(date -Is) Waiting ${update_interval}secs for status: $2; current status: $status ..." + sleep ${update_interval} + __cac_cli__waitstatus "$@" + fi } -- cgit v1.2.3