diff --git a/src/modules/debug/ee_mod_debug_php.sh b/src/modules/debug/ee_mod_debug_php.sh index 1b9032b0..55401c21 100644 --- a/src/modules/debug/ee_mod_debug_php.sh +++ b/src/modules/debug/ee_mod_debug_php.sh @@ -3,10 +3,10 @@ function ee_mod_debug_php() { if [ "$1" = "start" ]; then - grep -B2 9001 /etc/nginx/conf.d/upstream.conf | grep php &>> $EE_COMMAND_LOG + sed -n "/upstream php {/,/}/p" /etc/nginx/conf.d/upstream.conf | grep 9001 &>> $EE_COMMAND_LOG if [ $? -ne 0 ]; then ee_lib_echo "Setup PHP5-FPM slow log, please wait..." - sed -i "5 s/9000/9001/" /etc/nginx/conf.d/upstream.conf \ + sed -i "/upstream php {/,/}/s/9000/9001/" /etc/nginx/conf.d/upstream.conf \ || ee_lib_error "Unable to setup PHP5-FPM slow log, exit status = " $? # NGINX reload trigger @@ -16,10 +16,10 @@ function ee_mod_debug_php() ee_lib_echo "PHP5-FPM slow log already enabled" fi elif [ "$1" = "stop" ]; then - grep -B2 9001 /etc/nginx/conf.d/upstream.conf | grep php &>> $EE_COMMAND_LOG + sed -n "/upstream php {/,/}/p" /etc/nginx/conf.d/upstream.conf | grep 9001 &>> $EE_COMMAND_LOG if [ $? -eq 0 ]; then ee_lib_echo "Disable PHP5-FPM slow log, please wait..." - sed -i "5 s/9001/9000/" /etc/nginx/conf.d/upstream.conf \ + sed -i "/upstream php {/,/}/s/9001/9000/" /etc/nginx/conf.d/upstream.conf \ || ee_lib_error "Unable to disable PHP5-FPM slow log, exit status = " $? # NGINX reload trigger