winlin

update the stop/start script

@@ -4,7 +4,9 @@ if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; @@ -4,7 +4,9 @@ if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本";
4 4
5 cmd="sudo ./objs/nginx/sbin/nginx" 5 cmd="sudo ./objs/nginx/sbin/nginx"
6 echo "启动NGINX(HLS服务):$cmd" 6 echo "启动NGINX(HLS服务):$cmd"
7 -pids=`ps aux|grep nginx|grep process|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGKILL $pid; done 7 +if [[ -f ./objs/nginx/logs/nginx.pid ]]; then
  8 + pids=`cat ./objs/nginx/logs/nginx.pid`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGTERM $pid; done
  9 +fi
8 sudo ./objs/nginx/sbin/nginx 10 sudo ./objs/nginx/sbin/nginx
9 ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动NGINX(HLS服务)失败"; exit $ret; fi 11 ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动NGINX(HLS服务)失败"; exit $ret; fi
10 12
@@ -11,7 +11,9 @@ pids=`ps aux|grep srs|grep "./objs"|grep "srs.19350.conf"|awk '{print $2}'`; for @@ -11,7 +11,9 @@ pids=`ps aux|grep srs|grep "./objs"|grep "srs.19350.conf"|awk '{print $2}'`; for
11 # step 4(optinal): start nginx for HLS 11 # step 4(optinal): start nginx for HLS
12 echo "停止NGINX(HLS服务)" 12 echo "停止NGINX(HLS服务)"
13 ps aux|grep nginx|grep process 13 ps aux|grep nginx|grep process
14 -pids=`ps aux|grep nginx|grep process|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGKILL $pid; done 14 +if [[ -f ./objs/nginx/logs/nginx.pid ]]; then
  15 + pids=`cat ./objs/nginx/logs/nginx.pid`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGTERM $pid; done
  16 +fi
15 17
16 # step 5(optinal): start http hooks for srs callback 18 # step 5(optinal): start http hooks for srs callback
17 echo "停止API服务器" 19 echo "停止API服务器"