77# Try to visit WIKI to find a solution.
88
99# ###############################################
10+ NGINX_BIN=nginx
1011# NGINX_CONFIG=/etc/nginx/nginx.conf
1112# NGINX_CONFIG_HOME=/etc/nginx
1213# #################################################
1314
14- VER=1.14 .0
15+ VER=1.15 .0
1516
1617PROJECT_NAME=" httpsok"
1718PROJECT_ENTRY=" httpsok.sh"
@@ -166,27 +167,27 @@ _initparams() {
166167 exit 1
167168 fi
168169
169- nginx_bin =nginx
170- $nginx_bin -V > /dev/null 2>&1
170+ # NGINX_BIN =nginx
171+ $NGINX_BIN -V > /dev/null 2>&1
171172 if [ $? -ne 0 ]; then
172173 echo " no nginx in PATH, find the nginx"
173174 pid=$( ps -e | grep nginx | grep -v ' grep' | head -n 1 | awk ' {print $1}' )
174175 if [ -n " $pid " ]; then
175- nginx_bin =$( readlink -f /proc/" $pid " /exe)
176- # echo "nginx_bin=$nginx_bin "
176+ NGINX_BIN =$( readlink -f /proc/" $pid " /exe)
177+ # echo "NGINX_BIN=$NGINX_BIN "
177178 # again to verify
178- $nginx_bin -V > /dev/null 2>&1
179+ $NGINX_BIN -V > /dev/null 2>&1
179180 if [ $? -ne 0 ]; then
180181 _no_nginx_here
181182 else
182- echo " Nginx executable path: $nginx_bin "
183+ echo " Nginx executable path: $NGINX_BIN "
183184 fi
184185 else
185186 _no_nginx_here
186187 fi
187188 fi
188189
189- NGINX_VERSION=$( $nginx_bin -v 2>&1 | awk -F ' : ' ' {print $2}' | head -c 20)
190+ NGINX_VERSION=$( $NGINX_BIN -v 2>&1 | awk -F ' : ' ' {print $2}' | head -c 20)
190191
191192 # user can setting
192193 if [ -z " $NGINX_CONFIG " ]; then
@@ -196,7 +197,7 @@ _initparams() {
196197
197198 # fix the NGINX_CONFIG equals nginx.conf bug
198199 if [ -z " $NGINX_CONFIG " ] || [ " $NGINX_CONFIG " = " nginx.conf" ]; then
199- NGINX_CONFIG=$( $nginx_bin -t 2>&1 | grep ' configuration' | head -n 1 | awk -F ' file' ' {print $2}' | awk ' {print $1}' )
200+ NGINX_CONFIG=$( $NGINX_BIN -t 2>&1 | grep ' configuration' | head -n 1 | awk -F ' file' ' {print $2}' | awk ' {print $1}' )
200201 fi
201202
202203 if [ -z " $NGINX_CONFIG_HOME " ]; then
@@ -209,7 +210,7 @@ _initparams() {
209210 _info " version: $NGINX_VERSION "
210211 _info " nginx-config: $NGINX_CONFIG "
211212 _info " nginx-config-home: $NGINX_CONFIG_HOME "
212- _info " nginx-bin: $nginx_bin "
213+ _info " nginx-bin: $NGINX_BIN "
213214 _info " httpsok-uuid: $HTTPSOK_UUID "
214215
215216
@@ -686,14 +687,14 @@ _reload_nginx() {
686687 # fixbug: signal process started
687688 cd $NGINX_CONFIG_HOME
688689
689- msg=$( $nginx_bin -t 2>&1 )
690+ msg=$( $NGINX_BIN -t 2>&1 )
690691 if [ $? != 0 ]; then
691692 _remote_log " nginx-test-failed" " $latest_code " " $msg "
692693 echo
693694 _err " Nginx test failed. \n\n$msg "
694695 else
695- msg=$( $nginx_bin -s reload 2>&1 )
696- if [ " $msg " = " " ]; then
696+ msg=$( $NGINX_BIN -s reload 2>&1 )
697+ if [ $? -eq 0 ]; then
697698 _remote_log " nginx-reload-success" " $latest_code " " Nginx reload success."
698699 echo
699700 _suc " Nginx reload success."
0 commit comments