mirror of
https://github.com/ThunixdotNet/ansible.git
synced 2026-01-24 13:40:17 +00:00
Move the running process to its function
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user