1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix script run/build/stop bug

This commit is contained in:
winlin 2014-04-07 15:26:21 +08:00
parent 6f3af97068
commit 05e22e9530
17 changed files with 394 additions and 158 deletions

View file

@ -1,7 +0,0 @@
#!/bin/bash
for((;;)); do \
./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv \
-vcodec copy -acodec copy \
-f flv -y rtmp://127.0.0.1/live?vhost=demo.srs.com/livestream; \
sleep 1; \
done

View file

@ -1,7 +0,0 @@
#!/bin/bash
for((;;)); do \
./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv \
-vcodec copy -acodec copy \
-f flv -y rtmp://127.0.0.1/live?vhost=players/demo; \
sleep 1; \
done

View file

@ -1,10 +0,0 @@
#!/bin/bash
src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
echo "编译SRS"
./configure --with-ssl --with-hls --with-http-server --with-ffmpeg --with-transcode --with-http-callback && make
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误编译SRS失败"; exit $ret; fi
echo "编译SRS成功"
exit 0

View file

@ -1,12 +0,0 @@
#!/bin/bash
src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
cmd="nohup python ./research/api-server/server.py 8085 >./objs/api-server.log 2>&1 &"
echo "启动API服务器$cmd"
pids=`ps aux|grep python|grep research|grep "api-server"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
nohup python ./research/api-server/server.py 8085 >./objs/api-server.log 2>&1 &
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动API服务器失败"; exit $ret; fi
echo "启动API服务器成功"
exit 0

View file

@ -1,12 +0,0 @@
#!/bin/bash
src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
cmd="nohup bash ./scripts/_ffmpeg.demo.sh >./objs/ffmpeg-demo.log 2>&1 &"
echo "启动FFMPEG推送demo流(播放器上12路演示)$cmd"
pids=`ps aux|grep scripts|grep "/_ffmpeg.demo.sh"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
nohup bash ./scripts/_ffmpeg.demo.sh >./objs/ffmpeg-demo.log 2>&1 &
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动FFMPEG推送demo流(播放器上12路演示)失败"; exit $ret; fi
echo "启动FFMPEG推送demo流(播放器上12路演示)成功"
exit 0

View file

@ -1,12 +0,0 @@
#!/bin/bash
src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
cmd="nohup bash ./scripts/_ffmpeg.players.sh >./objs/ffmpeg-players.log 2>&1 &"
echo "启动FFMPEG推送players流(播放器上演示用)$cmd"
pids=`ps aux|grep scripts|grep "/_ffmpeg.players.sh"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
nohup bash ./scripts/_ffmpeg.players.sh >./objs/ffmpeg-players.log 2>&1 &
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动FFMPEG推送players流(播放器上演示用)失败"; exit $ret; fi
echo "启动FFMPEG推送players流(播放器上演示用)成功"
exit 0

View file

@ -1,14 +0,0 @@
#!/bin/bash
src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
cmd="sudo ./objs/nginx/sbin/nginx"
echo "启动NGINXHLS服务$cmd"
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 "错误启动NGINXHLS服务失败"; exit $ret; fi
echo "启动NGINXHLS服务成功"
exit 0

View file

@ -1,12 +0,0 @@
#!/bin/bash
src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
cmd="./objs/srs -c conf/demo.19350.conf"
echo "启动SRS转发服务器$cmd"
pids=`cat ./objs/srs.demo.19350.pid`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
./objs/srs -c conf/demo.19350.conf
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动SRS转发服务器失败"; exit $ret; fi
echo "启动SRS转发服务器成功"
exit 0

View file

@ -1,12 +0,0 @@
#!/bin/bash
src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
cmd="./objs/srs -c conf/demo.conf"
echo "启动SRS服务器$cmd"
pids=`cat ./objs/srs.demo.pid`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
./objs/srs -c conf/demo.conf
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动SRS失败"; exit $ret; fi
echo "启动SRS服务器成功"
exit 0

View file

@ -3,6 +3,8 @@ src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
# step 1: build srs
bash scripts/_step.build.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
echo "编译SRS"
./configure --with-ssl --with-hls --with-http-server --with-ingest --with-transcode --with-http-callback && make
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误编译SRS失败"; exit $ret; fi
echo "编译SRS成功"

View file

@ -8,29 +8,15 @@ GREEN="\\e[32m"
YELLOW="\\e[33m"
BLACK="\\e[0m"
# step 1: build srs
#bash scripts/_step.build.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
./etc/init.d/srs-demo restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动SRS失败"; exit $ret; fi
echo "启动SRS服务器成功"
# step 2: start srs
bash scripts/_step.start.srs.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
./etc/init.d/srs-demo-19350 restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动SRS转发服务器失败"; exit $ret; fi
echo "启动SRS转发服务器成功"
# step 3(optinal): start srs listen at 19350 to forward to
bash scripts/_step.start.srs.19350.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
./etc/init.d/srs-api restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动API服务器失败"; exit $ret; fi
echo "启动API服务器成功"
# REMOVED: for we use srs-http-server instead.
# step 4(optinal): start nginx for HLS
#bash scripts/_step.start.nginx.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
# step 5(optinal): start http hooks for srs callback
bash scripts/_step.start.api.server.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
# step 6: publish demo live stream
#bash scripts/_step.start.ffmpeg.demo.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
# step 7: publish players live stream
#bash scripts/_step.start.ffmpeg.players.sh; ret=$?; if [[ 0 -ne $ret ]]; then exit $ret; fi
# step 8: add server ip to client hosts as demo.
ip=`ifconfig|grep "inet"|grep "addr"|grep "Mask"|grep -v "127.0.0.1"|awk 'NR==1 {print $2}'|awk -F ':' '{print $2}'`
port=8085
cat<<END

View file

@ -1,34 +1,12 @@
#!/bin/bash
echo "停止SRS服务器"
ps aux|grep srs|grep "./objs"|grep "demo.conf"
pids=`cat ./objs/srs.demo.pid`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
./etc/init.d/srs-demo stop; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误停止SRS失败"; exit $ret; fi
echo "停止SRS服务器成功"
echo "停止SRS转发服务器"
ps aux|grep srs|grep "./objs"|grep "demo.19350.conf"
pids=`cat ./objs/srs.demo.19350.pid`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
./etc/init.d/srs-demo-19350 stop; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误停止SRS转发服务器失败"; exit $ret; fi
echo "停止SRS转发服务器成功"
# REMOVED: for we use srs-http-server instead.
# step 4(optinal): start nginx for HLS
#echo "停止NGINXHLS服务"
#ps aux|grep nginx|grep process
#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服务器"
ps aux|grep python|grep research|grep "api-server"
pids=`ps aux|grep python|grep research|grep "api-server"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
# step 6: publish demo live stream
#echo "停止FFMPEG推送demo流(播放器上12路演示)"
#ps aux|grep scripts|grep "ffmpeg.demo.sh"
#pids=`ps aux|grep scripts|grep "/_ffmpeg.demo.sh"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
# step 7: publish players live stream
#echo "停止FFMPEG推送players流(播放器上演示用)"
#ps aux|grep scripts|grep "ffmpeg.players.sh"
#pids=`ps aux|grep scripts|grep "/_ffmpeg.players.sh"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
./etc/init.d/srs-api stop; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误停止API服务器失败"; exit $ret; fi
echo "停止API服务器成功"
echo "SRS系统服务均已停止"