1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-12 19:31:53 +00:00
srs/trunk/scripts/run.sh

56 lines
2.1 KiB
Bash
Raw Normal View History

2013-12-23 05:16:31 +00:00
#!/bin/bash
src_dir='src'
if [[ ! -d $src_dir ]]; then echo "错误必须在src同目录执行脚本"; exit 1; fi
2013-12-23 05:38:31 +00:00
# linux shell color support.
RED="\\033[31m"
GREEN="\\033[32m"
YELLOW="\\033[33m"
BLACK="\\033[0m"
2013-12-23 05:38:31 +00:00
2014-04-07 07:26:21 +00:00
./etc/init.d/srs-demo restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动SRS失败"; exit $ret; fi
echo "启动SRS服务器成功"
2013-12-23 05:16:31 +00:00
2014-04-07 07:26:21 +00:00
./etc/init.d/srs-demo-19350 restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动SRS转发服务器失败"; exit $ret; fi
echo "启动SRS转发服务器成功"
2013-12-23 05:16:31 +00:00
2014-04-07 07:26:21 +00:00
./etc/init.d/srs-api restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误启动API服务器失败"; exit $ret; fi
echo "启动API服务器成功"
2013-12-23 05:16:31 +00:00
2014-10-09 03:32:12 +00:00
ip=`ifconfig|grep "inet "|grep -v "127.0.0.1"|awk -F 'inet ' 'NR==1 {print $2}'|awk '{print $1}'|sed "s/addr://g"`
2014-04-06 11:13:29 +00:00
port=8085
2013-12-23 05:16:31 +00:00
cat<<END
2013-12-23 05:38:31 +00:00
默认的12路流演示
2014-04-06 11:13:29 +00:00
http://$ip:$port/players
2013-12-23 05:38:31 +00:00
默认的播放器流演示:
2014-04-06 11:13:29 +00:00
http://$ip:$port/players/srs_player.html?vhost=players
2013-12-23 05:38:31 +00:00
推流(主播)应用演示:
2014-04-06 11:13:29 +00:00
http://$ip:$port/players/srs_publisher.html?vhost=players
2013-12-23 05:38:31 +00:00
视频会议(聊天室)应用演示:
2014-04-06 11:13:29 +00:00
http://$ip:$port/players/srs_chat.html?vhost=players
默认的测速应用演示:
2014-04-06 11:13:29 +00:00
http://$ip:$port/players/srs_bwt.html?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com
2013-12-23 05:16:31 +00:00
END
2014-10-09 03:53:21 +00:00
which getenforce >/dev/null 2>&1
if [[ 0 -eq $? && `getenforce` != 'Disabled' ]]; then
echo -e "${RED}请关闭selinux${BLACK}";
echo -e "${RED} 打开配置文件sudo vi /etc/sysconfig/selinux${BLACK}";
echo -e "${RED} 修改为SELINUX=disabled${BLACK}";
echo -e "${RED} 重启系统sudo reboot${BLACK}";
fi
2014-10-09 04:09:01 +00:00
if [[ -f /etc/init.d/iptables ]]; then
sudo /etc/init.d/iptables status >/dev/null 2>&1;
if [[ $? -ne 3 ]]; then
echo -e "${RED}请关闭防火墙:${BLACK}";
echo -e "${RED} sudo /etc/init.d/iptables stop${BLACK}";
fi
fi
2014-10-09 03:53:21 +00:00
echo -e "${GREEN}请在hosts中添加一行${BLACK}"
echo -e "${RED} $ip demo.srs.com${BLACK}"
2013-12-23 05:38:31 +00:00
echo -e "${GREEN}演示地址:${BLACK}"
2014-04-06 11:13:29 +00:00
echo -e "${RED} http://$ip:$port${BLACK}"
2015-11-11 02:37:50 +00:00
echo -e "@see https://github.com/ossrs/srs/wiki/v1_CN_SampleDemo"