winlin

update build/run/stop script

@@ -320,7 +320,7 @@ function write_nginx_html5() @@ -320,7 +320,7 @@ function write_nginx_html5()
320 END 320 END
321 } 321 }
322 # create the nginx dir, for http-server if not build nginx 322 # create the nginx dir, for http-server if not build nginx
323 -mkdir -p ${SRS_OBJS}/nginx 323 +rm -rf ${SRS_OBJS}/nginx && mkdir -p ${SRS_OBJS}/nginx
324 # make nginx 324 # make nginx
325 __SRS_BUILD_NGINX=NO; if [ $SRS_ARM_UBUNTU12 = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi 325 __SRS_BUILD_NGINX=NO; if [ $SRS_ARM_UBUNTU12 = NO ]; then if [ $SRS_NGINX = YES ]; then __SRS_BUILD_NGINX=YES; fi fi
326 if [ $__SRS_BUILD_NGINX = YES ]; then 326 if [ $__SRS_BUILD_NGINX = YES ]; then
@@ -11,6 +11,17 @@ pid ./objs/srs.demo.pid; @@ -11,6 +11,17 @@ pid ./objs/srs.demo.pid;
11 chunk_size 60000; 11 chunk_size 60000;
12 max_connections 2000; 12 max_connections 2000;
13 13
  14 +http_api {
  15 + enabled on;
  16 + listen 1985;
  17 +}
  18 +
  19 +http_stream {
  20 + enabled on;
  21 + listen 8080;
  22 + dir ./objs/nginx/html;
  23 +}
  24 +
14 vhost __defaultVhost__ { 25 vhost __defaultVhost__ {
15 enabled on; 26 enabled on;
16 gop_cache on; 27 gop_cache on;
@@ -3,7 +3,7 @@ src_dir='src' @@ -3,7 +3,7 @@ src_dir='src'
3 if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi 3 if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi
4 4
5 echo "编译SRS" 5 echo "编译SRS"
6 -./configure --with-ssl --with-hls --with-nginx --with-ffmpeg --with-http-callback && make 6 +./configure --with-ssl --with-hls --with-http-server --with-ffmpeg --with-http-callback && make
7 ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:编译SRS失败"; exit $ret; fi 7 ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:编译SRS失败"; exit $ret; fi
8 8
9 echo "编译SRS成功" 9 echo "编译SRS成功"
@@ -4,7 +4,7 @@ if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; @@ -4,7 +4,7 @@ if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本";
4 4
5 cmd="./objs/srs -c conf/demo.19350.conf" 5 cmd="./objs/srs -c conf/demo.19350.conf"
6 echo "启动SRS转发服务器:$cmd" 6 echo "启动SRS转发服务器:$cmd"
7 -pids=`ps aux|grep srs|grep "./objs"|grep "demo.19350.conf"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done 7 +pids=`cat ./objs/srs.demo.19350.pid`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
8 ./objs/srs -c conf/demo.19350.conf 8 ./objs/srs -c conf/demo.19350.conf
9 ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS转发服务器失败"; exit $ret; fi 9 ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS转发服务器失败"; exit $ret; fi
10 10
@@ -4,7 +4,7 @@ if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; @@ -4,7 +4,7 @@ if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本";
4 4
5 cmd="./objs/srs -c conf/demo.conf" 5 cmd="./objs/srs -c conf/demo.conf"
6 echo "启动SRS服务器:$cmd" 6 echo "启动SRS服务器:$cmd"
7 -pids=`ps aux|grep srs|grep "./objs"|grep "demo.conf"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done 7 +pids=`cat ./objs/srs.demo.pid`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
8 ./objs/srs -c conf/demo.conf 8 ./objs/srs -c conf/demo.conf
9 ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS失败"; exit $ret; fi 9 ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS失败"; exit $ret; fi
10 10
@@ -17,8 +17,9 @@ bash scripts/_step.start.srs.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi @@ -17,8 +17,9 @@ bash scripts/_step.start.srs.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
17 # step 3(optinal): start srs listen at 19350 to forward to 17 # step 3(optinal): start srs listen at 19350 to forward to
18 bash scripts/_step.start.srs.19350.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi 18 bash scripts/_step.start.srs.19350.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
19 19
  20 +# REMOVED: for we use srs-http-server instead.
20 # step 4(optinal): start nginx for HLS 21 # step 4(optinal): start nginx for HLS
21 -bash scripts/_step.start.nginx.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi 22 +#bash scripts/_step.start.nginx.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
22 23
23 # step 5(optinal): start http hooks for srs callback 24 # step 5(optinal): start http hooks for srs callback
24 bash scripts/_step.start.api.server.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi 25 bash scripts/_step.start.api.server.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
@@ -31,18 +32,18 @@ bash scripts/_step.start.ffmpeg.players.sh; ret=$?; if [[ 0 -ne $ret ]]; then ex @@ -31,18 +32,18 @@ bash scripts/_step.start.ffmpeg.players.sh; ret=$?; if [[ 0 -ne $ret ]]; then ex
31 32
32 # step 8: add server ip to client hosts as demo. 33 # step 8: add server ip to client hosts as demo.
33 ip=`ifconfig|grep "inet"|grep "addr"|grep "Mask"|grep -v "127.0.0.1"|awk 'NR==1 {print $2}'|awk -F ':' '{print $2}'` 34 ip=`ifconfig|grep "inet"|grep "addr"|grep "Mask"|grep -v "127.0.0.1"|awk 'NR==1 {print $2}'|awk -F ':' '{print $2}'`
  35 +port=8085
34 cat<<END 36 cat<<END
35 默认的12路流演示: 37 默认的12路流演示:
36 - http://$ip/players 38 + http://$ip:$port/players
37 默认的播放器流演示: 39 默认的播放器流演示:
38 - http://$ip/players/srs_player.html?vhost=players 40 + http://$ip:$port/players/srs_player.html?vhost=players
39 推流(主播)应用演示: 41 推流(主播)应用演示:
40 - http://$ip/players/srs_publisher.html?vhost=players 42 + http://$ip:$port/players/srs_publisher.html?vhost=players
41 视频会议(聊天室)应用演示: 43 视频会议(聊天室)应用演示:
42 - http://$ip/players/srs_chat.html?vhost=players 44 + http://$ip:$port/players/srs_chat.html?vhost=players
43 默认的测速应用演示: 45 默认的测速应用演示:
44 - http://$ip/players/srs_bwt.html?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com 46 + http://$ip:$port/players/srs_bwt.html?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com
45 END 47 END
46 echo -e "${GREEN}演示地址:${BLACK}" 48 echo -e "${GREEN}演示地址:${BLACK}"
47 -echo -e "${RED} http://$ip${BLACK}"  
48 -echo -e "${RED} http://$ip:8085${BLACK}" 49 +echo -e "${RED} http://$ip:$port${BLACK}"
@@ -2,18 +2,19 @@ @@ -2,18 +2,19 @@
2 2
3 echo "停止SRS服务器" 3 echo "停止SRS服务器"
4 ps aux|grep srs|grep "./objs"|grep "demo.conf" 4 ps aux|grep srs|grep "./objs"|grep "demo.conf"
5 -pids=`ps aux|grep srs|grep "./objs"|grep "demo.conf"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done 5 +pids=`cat ./objs/srs.demo.pid`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
6 6
7 echo "停止SRS转发服务器" 7 echo "停止SRS转发服务器"
8 ps aux|grep srs|grep "./objs"|grep "demo.19350.conf" 8 ps aux|grep srs|grep "./objs"|grep "demo.19350.conf"
9 -pids=`ps aux|grep srs|grep "./objs"|grep "demo.19350.conf"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done 9 +pids=`cat ./objs/srs.demo.19350.pid`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
10 10
  11 +# REMOVED: for we use srs-http-server instead.
11 # step 4(optinal): start nginx for HLS 12 # step 4(optinal): start nginx for HLS
12 -echo "停止NGINX(HLS服务)"  
13 -ps aux|grep nginx|grep process  
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 13 +#echo "停止NGINX(HLS服务)"
  14 +#ps aux|grep nginx|grep process
  15 +#if [[ -f ./objs/nginx/logs/nginx.pid ]]; then
  16 +# pids=`cat ./objs/nginx/logs/nginx.pid`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGTERM $pid; done
  17 +#fi
17 18
18 # step 5(optinal): start http hooks for srs callback 19 # step 5(optinal): start http hooks for srs callback
19 echo "停止API服务器" 20 echo "停止API服务器"