summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-12-18 10:58:15 +0100
committermakefu <github@syntax-fehler.de>2015-12-18 10:58:15 +0100
commited1de450240582ce034ee5d0da918c236c3d199f (patch)
treef1b4ff5a2e4d3d88cdc990070b27770d17912967
parent2bc4a01f8728f75da90890b49d9a339b2a5c0720 (diff)
cac: use sleep if always_update instead of inotify
-rwxr-xr-xcac14
1 files 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
}