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