Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

deploy-directory-to-remote.sh 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #! /bin/sh
  2. #
  3. if [ "$#" -eq 0 ] || [ "$#" -gt 1 ]; then
  4. echo takes only one argument
  5. exit 1
  6. fi
  7. if [ ! -e "${1}" ]; then
  8. echo cannot find "${1}"
  9. exit 1
  10. fi
  11. # shellcheck source=./deployment/deployment-example.env
  12. . "${1}"
  13. if [ "${do_backup}" = "yes" ]; then
  14. if ssh ${remote_ssh_string} "mkdir --parents ${remote_deployment_directory_path}"; then
  15. echo deployment folder successfully created on remote
  16. else
  17. echo deployment folder creation on remote failed
  18. exit 1
  19. fi
  20. if ssh ${remote_ssh_string} "cp --archive --recursive ${remote_directory_path} ${remote_deployment_directory_path}/$(basename ${remote_directory_path}).backup.${now}"; then
  21. echo backup of current remote directory successfully created on remote
  22. else
  23. echo backup of current remote directory failed
  24. exit 1
  25. fi
  26. fi
  27. if [ "${remote_is_docker}" != "yes" ]; then
  28. if ssh ${remote_ssh_string} "wp option patch update wpmm_settings general status 1 --path=${remote_wp_path}"; then
  29. echo maintenance mode activated
  30. else
  31. echo something went horribly wrong
  32. exit 1
  33. fi
  34. fi
  35. if rsync --compress --delete --delete-excluded --exclude-from="${deployment_exclude_file}" --executability --human-readable --progress --update --recursive "${local_directory_path}/" "${remote_ssh_string}":"${remote_directory_path}"; then
  36. echo syncing OK
  37. else
  38. echo syncing NOK
  39. exit 1
  40. fi
  41. if [ "${remote_is_docker}" != "yes" ]; then
  42. if ssh ${remote_ssh_string} "wp option patch update wpmm_settings general status 0 --path=${remote_wp_path}"; then
  43. echo maintenance mode deactivated
  44. else
  45. echo something went horribly wrong
  46. exit 1
  47. fi
  48. fi