forked from thunix/ansible
Move the running process to its function
This commit is contained in:
parent
bc572d9010
commit
5c53230537
|
@ -1,14 +1,19 @@
|
|||
#!/bin/bash
|
||||
export RUNNING="/dev/shm/ansible_is_running"
|
||||
|
||||
ansible_is_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
|
||||
}
|
||||
|
||||
if [ -f $RUNNING ]; then
|
||||
echo "Ansible is currently running."
|
||||
exit 1
|
||||
else
|
||||
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
|
||||
ansible_is_running
|
||||
touch /dev/shm/ansible-hook-last-run
|
||||
rm $RUNNING
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue