#!/bin/bash src_dir='src' if [[ ! -d $src_dir ]]; then echo "错误:必须在src同目录执行脚本"; exit 1; fi # linux shell color support. RED="\\e[31m" GREEN="\\e[32m" YELLOW="\\e[33m" BLACK="\\e[0m" ./etc/init.d/srs-demo restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS失败"; exit $ret; fi echo "启动SRS服务器成功" ./etc/init.d/srs-demo-19350 restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动SRS转发服务器失败"; exit $ret; fi echo "启动SRS转发服务器成功" ./etc/init.d/srs-api restart; ret=$?; if [[ 0 -ne $ret ]]; then echo "错误:启动API服务器失败"; exit $ret; fi echo "启动API服务器成功" ip=`ifconfig|grep "inet "|grep -v "127.0.0.1"|awk -F 'inet ' 'NR==1 {print $2}'|awk '{print $1}'|sed "s/addr://g"` port=8085 cat</dev/null 2>&1; if [[ $? -ne 3 ]]; then echo -e "${RED}请关闭防火墙:${BLACK}"; echo -e "${RED} sudo /etc/init.d/iptables stop${BLACK}"; fi fi echo -e "${GREEN}请在hosts中添加一行:${BLACK}" echo -e "${RED} $ip demo.srs.com${BLACK}" echo -e "${GREEN}演示地址:${BLACK}" echo -e "${RED} http://$ip:$port${BLACK}" echo -e "@see https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SampleDemo"