From bc14e416155f7af6525f7b0c1ffc6e7a613c4558 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Vanhalle Date: Mon, 20 Nov 2023 00:41:25 +0100 Subject: [PATCH] adds an option to prevent running wp-cli when remote is running in a container --- deploy-directory-to-remote.sh | 24 ++++++++++++++---------- deployment/deployment-example.env | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/deploy-directory-to-remote.sh b/deploy-directory-to-remote.sh index c95a113..b53dd3a 100755 --- a/deploy-directory-to-remote.sh +++ b/deploy-directory-to-remote.sh @@ -28,11 +28,13 @@ else exit 1 fi -if ssh ${remote_ssh_string} "wp option patch update wpmm_settings general status 1 --path=${remote_wp_path}"; then - echo maintenance mode activated -else - echo something went horribly wrong - exit 1 +if [ "${remote_is_docker}" != "yes" ]; then + if ssh ${remote_ssh_string} "wp option patch update wpmm_settings general status 1 --path=${remote_wp_path}"; then + echo maintenance mode activated + else + echo something went horribly wrong + exit 1 + fi fi if rsync --archive --compress --delete --delete-excluded --exclude-from="${deployment_exclude_file}" --human-readable --progress "${local_directory_path}/" "${remote_ssh_string}":"${remote_directory_path}"; then @@ -42,9 +44,11 @@ else exit 1 fi -if ssh ${remote_ssh_string} "wp option patch update wpmm_settings general status 0 --path=${remote_wp_path}"; then - echo maintenance mode deactivated -else - echo something went horribly wrong - exit 1 +if [ "${remote_is_docker}" != "yes" ]; then + if ssh ${remote_ssh_string} "wp option patch update wpmm_settings general status 0 --path=${remote_wp_path}"; then + echo maintenance mode deactivated + else + echo something went horribly wrong + exit 1 + fi fi diff --git a/deployment/deployment-example.env b/deployment/deployment-example.env index c9a0525..380bb3d 100644 --- a/deployment/deployment-example.env +++ b/deployment/deployment-example.env @@ -4,3 +4,4 @@ remote_deployment_path= remote_directory_path= remote_ssh_string= remote_wp_path= +remote_is_docker=