From 19ced42e6bfd243baa31b05301e5252e3800b52f Mon Sep 17 00:00:00 2001 From: Naglfar Date: Mon, 7 Dec 2020 16:32:19 +0100 Subject: [PATCH] Only touch and remove it once --- roles/common/files/ansible-run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/common/files/ansible-run b/roles/common/files/ansible-run index 31b3341..1dda298 100644 --- a/roles/common/files/ansible-run +++ b/roles/common/files/ansible-run @@ -5,11 +5,9 @@ export SCHED="/dev/shm/ansible_scheduler" ansible_is_running() { - touch $RUNNING cd /var/thunix/ansible /usr/bin/git pull /usr/local/bin/ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml -u root - rm $RUNNING } # sets ansible scheduling @@ -18,10 +16,12 @@ touch $SCHED if [ -f $RUNNING ]; then echo "Ansible is currently running." else + touch $RUNNING while [ -f $SCHED ] do rm $SCHED ansible_is_running touch $HOOK done + rm $RUNNING fi