diff --git a/trunk/scripts/_step.start.nginx.sh b/trunk/scripts/_step.start.nginx.sh index 22d2a3db4..8873f093c 100755 --- a/trunk/scripts/_step.start.nginx.sh +++ b/trunk/scripts/_step.start.nginx.sh @@ -4,7 +4,9 @@ if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; cmd="sudo ./objs/nginx/sbin/nginx" echo "启动NGINX(HLS服务):$cmd" -pids=`ps aux|grep nginx|grep process|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGKILL $pid; done +if [[ -f ./objs/nginx/logs/nginx.pid ]]; then + pids=`cat ./objs/nginx/logs/nginx.pid`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGTERM $pid; done +fi sudo ./objs/nginx/sbin/nginx ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动NGINX(HLS服务)失败"; exit $ret; fi diff --git a/trunk/scripts/stop.sh b/trunk/scripts/stop.sh index a916045d6..e7a3be538 100755 --- a/trunk/scripts/stop.sh +++ b/trunk/scripts/stop.sh @@ -11,7 +11,9 @@ pids=`ps aux|grep srs|grep "./objs"|grep "srs.19350.conf"|awk '{print $2}'`; for # step 4(optinal): start nginx for HLS echo "停止NGINX(HLS服务)" ps aux|grep nginx|grep process -pids=`ps aux|grep nginx|grep process|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGKILL $pid; done +if [[ -f ./objs/nginx/logs/nginx.pid ]]; then + pids=`cat ./objs/nginx/logs/nginx.pid`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGTERM $pid; done +fi # step 5(optinal): start http hooks for srs callback echo "停止API服务器"