I have a bash script, which I execute on a node using Ansible.
- name : execute the script for uploading www files
shell: /root/upload_www.sh
Part of the script is executing:
ssh -t -o StrictHostKeyChecking=no -i $key user@$backupsrv "sudo rsync -ravzhe \"ssh -o StrictHostKeyChecking=no -i $key\" /var/www/html user@$source:/var/www/"
That script executes very long time (about 3 hours, because there are rsync tasks with about 80gb of data and other logic) and the Ansible task finishes with an error message: "Killed" but the script
continues to execute and all tasks in that script do eventually finish successfully.
On the Ansible host after running the command ansible-playbook www.yml I get the following output:
# echo $?
137
How can I wait for my script to end properly?