copy.sh 548 B

123456789101112131415
  1. #!/bin/bash
  2. export DOCKER_HOST=tcp://dev-iru-swarm.infoclinica.lan:2376 DOCKER_TLS_VERIFY=1
  3. docker service ps bind --format "{{.Node}} {{.DesiredState}}" | while read host status
  4. do
  5. if [ ${status} == Running ]
  6. then
  7. export DOCKER_HOST=tcp://${host}:2376 DOCKER_TLS_VERIFY=1
  8. container_id=$(docker ps|grep bind|awk '{print $1}')
  9. echo ${container_id}
  10. docker cp ${container_id}:/var/bind/infoclinica .
  11. fi
  12. done
  13. scp -r infoclinica ns41.infoclinica.lan:/var/named
  14. rm -rf infoclinica
  15. ssh ns41.infoclinica.lan 'systemctl restart named'