選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

35 行
790B

  1. #!/bin/bash
  2. STACK_NAME=$1
  3. if [ $# -eq 0 ]; then
  4. echo "You must pass stack name as a parameter"
  5. exit 1
  6. fi
  7. # ##### Add Let's Encrypt certificates ###### #
  8. # Find Nextcloud container
  9. SERVICE=nextcloud
  10. host=$(docker stack ps ${STACK_NAME} | grep Running | grep ${SERVICE} | awk '{ print $4 }')
  11. #echo Host=$host
  12. if [ -z $host ]; then
  13. echo "No host found!";
  14. exit 1;
  15. fi
  16. # add avahi suffix
  17. localhostname=$(cat /etc/hostname)
  18. if [ "${localhostname}" != "${host}" ]; then
  19. host=${host}.local
  20. fi
  21. container=$(ssh $host 'docker ps | grep '${SERVICE}' | cut -f1 -d" "')
  22. #echo Container=$container
  23. if [ -z $container ]; then
  24. echo "Qué me estás container?!";
  25. exit 1;
  26. fi
  27. # Run script in container
  28. ssh $host "docker exec ${container} sh -c '/usr/local/bin/letsencrypt.sh'"