1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 20:01:56 +00:00
srs/trunk/scripts/dev.sh
2013-12-23 10:40:11 +08:00

56 lines
3.3 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
# step 1: build srs
echo "编译SRS"
./configure --with-ssl --with-hls --with-ffmpeg --with-http && make
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误编译SRS失败"; exit $ret; fi
# step 2: start srs
cmd="nohup ./objs/srs -c conf/srs.conf >./objs/logs/srs.log 2>&1 &"
echo "启动SRS服务器$cmd"
pids=`ps aux|grep srs|grep "./objs"|grep "srs.conf"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
nohup ./objs/srs -c conf/srs.conf >./objs/logs/srs.log 2>&1 &
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动SRS失败"; exit $ret; fi
## step 3(optinal): start srs listen at 19350 to forward to
#cmd="nohup ./objs/srs -c conf/srs.19350.conf > ./objs/logs/srs.19350.log 2>&1 &"
#echo "启动SRS转发服务器$cmd"
#pids=`ps aux|grep srs|grep "./objs"|grep "srs.19350.conf"|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; kill -s SIGKILL $pid; done
#nohup ./objs/srs -c conf/srs.19350.conf > ./objs/logs/srs.19350.log 2>&1 &
#ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动SRS转发服务器失败"; exit $ret; fi
# step 4(optinal): start nginx for HLS
cmd="sudo ./objs/nginx/sbin/nginx"
echo "启动NGINXHLS服务$cmd"
pids=`ps aux|grep nginx|grep process|awk '{print $2}'`; for pid in $pids; do echo "结束现有进程:$pid"; sudo kill -s SIGKILL $pid; done
sudo ./objs/nginx/sbin/nginx
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动NGINXHLS服务失败"; exit $ret; fi
# step 5(optinal): start http hooks for srs callback
cmd="nohup python ./research/api-server/server.py 8085 >./objs/logs/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/logs/api-server.log 2>&1 &
ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动API服务器失败"; exit $ret; fi
## step 6: publish demo live stream
#cmd="nohup bash scripts/ffmpeg.demo.sh >./objs/logs/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/logs/ffmpeg-demo.log 2>&1 &
#ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动FFMPEG推送demo流(播放器上12路演示)失败"; exit $ret; fi
##
## step 7: publish players live stream
#cmd="nohup bash scripts/ffmpeg.players.sh >./objs/logs/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/logs/ffmpeg-players.log 2>&1 &
#ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动FFMPEG推送players流(播放器上演示用)失败"; exit $ret; fi
# step 8: add server ip to client hosts as demo.
cat<<END
SRS系统开发环境启动成功
默认的播放器流演示http://dev/players
END