From e8e73a0431cd9417fa69a96b98ae424ae52b96b7 Mon Sep 17 00:00:00 2001 From: Daryl Lozupone Date: Wed, 31 Aug 2016 11:19:51 -0400 Subject: [PATCH] Add check to set-web-processvm to verify process sock exists clases #12 --- guest/cli/includes/set-web-processvm | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/guest/cli/includes/set-web-processvm b/guest/cli/includes/set-web-processvm index 5b0f7a8..42c4b6f 100755 --- a/guest/cli/includes/set-web-processvm +++ b/guest/cli/includes/set-web-processvm @@ -4,7 +4,6 @@ echo echo "Setting Web Process VM to $1..." echo - function editfile { sudo sed -i "s/$1/$2/" "$3" } @@ -17,10 +16,17 @@ function delfile { conf_file="/etc/nginx/sites-available/default" -editfile "php5.6" "$1" "$conf_file" -delfile "$conf_file" +if [ -f "/var/run/php/$1.sock" ] || [ -f "/var/run/php/$1-fpm.sock" ]; then + editfile "php5.6" "$1" "$conf_file" + delfile "$conf_file" + + editfile "php7.0" "$1" "$conf_file" + delfile "$conf_file" -editfile "php7.0" "$1" "$conf_file" -delfile "$conf_file" + sudo service nginx reload -sudo service nginx reload \ No newline at end of file + return 0 +else + echo_if_not_quiet "$*" "=The $1 process is not currently running on this machine!" + return 1 +fi