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
|
#!/bin/bash
|
||||||
export RUNNING="/dev/shm/ansible_is_running"
|
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
|
if [ -f $RUNNING ]; then
|
||||||
echo "Ansible is currently running."
|
echo "Ansible is currently running."
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
touch $RUNNING
|
touch $RUNNING
|
||||||
cd /var/thunix/ansible
|
ansible_is_running
|
||||||
/usr/bin/git pull
|
|
||||||
/usr/local/bin/ansible-playbook -i /var/thunix/ansible/hosts /var/thunix/ansible/site.yml -u root
|
|
||||||
touch /dev/shm/ansible-hook-last-run
|
touch /dev/shm/ansible-hook-last-run
|
||||||
rm $RUNNING
|
rm $RUNNING
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user