diff --git a/README.md b/README.md
index 043f1b220..87ccdbacc 100755
--- a/README.md
+++ b/README.md
@@ -16,14 +16,18 @@ who is the contributors:
2. the name of all contributors will send in the response of NetConnection.connect and metadata.
### Usage(simple)
-step 0: get srs
+step -1: get srs
git clone https://github.com/winlinvip/simple-rtmp-server &&
cd simple-rtmp-server/trunk
-step 1: build and start srs all demo features.
+step 0: build srs system.
-bash scripts/demo.sh
+bash scripts/build.sh
+
+step 1: start srs all demo features.
+
+bash scripts/run.sh
step 2: srs live show: [http://demo.srs.com/players](http://demo.srs.com/players)
requires client add server ip to hosts.
diff --git a/trunk/scripts/ffmpeg.demo.sh b/trunk/scripts/_ffmpeg.demo.sh
similarity index 100%
rename from trunk/scripts/ffmpeg.demo.sh
rename to trunk/scripts/_ffmpeg.demo.sh
diff --git a/trunk/scripts/ffmpeg.players.sh b/trunk/scripts/_ffmpeg.players.sh
similarity index 100%
rename from trunk/scripts/ffmpeg.players.sh
rename to trunk/scripts/_ffmpeg.players.sh
diff --git a/trunk/scripts/_step.build.sh b/trunk/scripts/_step.build.sh
new file mode 100755
index 000000000..1892a3c7d
--- /dev/null
+++ b/trunk/scripts/_step.build.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+src_dir='src'
+if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi
+
+echo "编译SRS"
+./configure --with-ssl --with-hls --with-ffmpeg --with-http && make
+ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:编译SRS失败"; exit $ret; fi
+
+echo "编译SRS成功"
+exit 0
diff --git a/trunk/scripts/_step.start.api.server.sh b/trunk/scripts/_step.start.api.server.sh
new file mode 100755
index 000000000..73b1a6d40
--- /dev/null
+++ b/trunk/scripts/_step.start.api.server.sh
@@ -0,0 +1,12 @@
+#!/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/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
+
+echo "启动API服务器成功"
+exit 0
diff --git a/trunk/scripts/_step.start.ffmpeg.demo.sh b/trunk/scripts/_step.start.ffmpeg.demo.sh
new file mode 100755
index 000000000..bdfb8fd1a
--- /dev/null
+++ b/trunk/scripts/_step.start.ffmpeg.demo.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+src_dir='src'
+if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi
+
+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
+
+echo "启动FFMPEG推送demo流(播放器上12路演示)成功"
+exit 0
diff --git a/trunk/scripts/_step.start.ffmpeg.players.sh b/trunk/scripts/_step.start.ffmpeg.players.sh
new file mode 100755
index 000000000..c5c6ac695
--- /dev/null
+++ b/trunk/scripts/_step.start.ffmpeg.players.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+src_dir='src'
+if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi
+
+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
+
+echo "启动FFMPEG推送players流(播放器上演示用)成功"
+exit 0
diff --git a/trunk/scripts/_step.start.nginx.sh b/trunk/scripts/_step.start.nginx.sh
new file mode 100755
index 000000000..22d2a3db4
--- /dev/null
+++ b/trunk/scripts/_step.start.nginx.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+src_dir='src'
+if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi
+
+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
+sudo ./objs/nginx/sbin/nginx
+ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动NGINX(HLS服务)失败"; exit $ret; fi
+
+echo "启动NGINX(HLS服务)成功"
+exit 0
diff --git a/trunk/scripts/_step.start.srs.19350.sh b/trunk/scripts/_step.start.srs.19350.sh
new file mode 100755
index 000000000..352506bb2
--- /dev/null
+++ b/trunk/scripts/_step.start.srs.19350.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+src_dir='src'
+if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi
+
+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
+
+echo "启动SRS转发服务器成功"
+exit 0
diff --git a/trunk/scripts/_step.start.srs.sh b/trunk/scripts/_step.start.srs.sh
new file mode 100755
index 000000000..de49a2064
--- /dev/null
+++ b/trunk/scripts/_step.start.srs.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+src_dir='src'
+if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi
+
+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
+
+echo "启动SRS服务器成功"
+exit 0
diff --git a/trunk/scripts/build.sh b/trunk/scripts/build.sh
new file mode 100755
index 000000000..695442d84
--- /dev/null
+++ b/trunk/scripts/build.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+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成功"
diff --git a/trunk/scripts/demo.sh b/trunk/scripts/demo.sh
deleted file mode 100755
index 8c4ccea0c..000000000
--- a/trunk/scripts/demo.sh
+++ /dev/null
@@ -1,64 +0,0 @@
-#!/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 "启动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
-sudo ./objs/nginx/sbin/nginx
-ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动NGINX(HLS服务)失败"; 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<./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
+bash scripts/_step.start.srs.sh; ret=$?; if [[ 0 -ne $ret ]]; then 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 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
# step 4(optinal): start nginx for HLS
-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
-sudo ./objs/nginx/sbin/nginx
-ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动NGINX(HLS服务)失败"; exit $ret; fi
+bash scripts/_step.start.nginx.sh; ret=$?; if [[ 0 -ne $ret ]]; then 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
+bash scripts/_step.start.api.server.sh; ret=$?; if [[ 0 -ne $ret ]]; then 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 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.
cat<