more yc_install10-20.sh
#英超直播p2p服务器安装脚本
#!/bin/sh
#by expert1
############# install service of yingchao ;ch3.......ch10 ######################
#### warning: please run it such as "/bin/sh yc_install.sh myip
###########
ip=$1
cat >/data/tcast_beta/bin/reportserver.sh <#!/bin/bash
nohup ./reportserver -p 18885 -u >reportserver_run.log 2>&1 &
exit
EOF
cat >/data/tcast_beta/bin/p2pserver.sh <#!/bin/bash
nohup ./p2pserver >p2pserver_run.log 2>&1 &
exit
EOF
cat >/data/tcast_beta/bin/tcast_root.sh <#!/bin/bash
nohup ./tcast_root -f nba.ini >tcast_root_run.log 2>&1 &
exit
EOF
for i in 11 12 13 14 15 16 17 18 19 20 ;do
mkdir /data/tcast_beta/ch${i}
cp -r /data/tcast_beta/bin/* /data/tcast_beta/ch${i}
rm -rf /data/tcast_beta/ch${i}/*.log
done
############## rename ######
for e in 11 12 13 14 15 16 17 18 19 20 ;do
mv /data/tcast_beta/ch${e}/p2pserver /data/tcast_beta/ch${e}/ch${e}_p2pserver
mv /data/tcast_beta/ch${e}/reportserver /data/tcast_beta/ch${e}/ch${e}_reportserver
mv /data/tcast_beta/ch${e}/tcast_root /data/tcast_beta/ch${e}/ch${e}_tcast_root
done
##############################
for((x=11;x<=20;x++));do
#################### p2pserver.ini
sed -i "s#local_addr.*18888#local_addr=${ip}:10$((x-1))3#" /data/tcast_beta/ch${x}/p2pserver.ini
sed -i "s#.*18885#reportserver=${ip}:10$((x-1))4#" /data/tcast_beta/ch${x}/p2pserver.ini
#################### reportserver.sh && tcast_root.sh
sed -i "s#reportserver#ch${x}_reportserver#1;s#18885#10$((x-1))4#" /data/tcast_beta/ch${x}/reportserver.sh
sed -i "s#tcast#ch${x}_tcast#1" /data/tcast_beta/ch${x}/tcast_root.sh
sed -i "s#p2pserver#ch${x}_p2pserver#1" /data/tcast_beta/ch${x}/p2pserver.sh
done
for ((x=11;x<=20;x++));do
################ modify /path/ch{x}/nba.ini #################
cp -r /data/tcast_beta/bin/nba.ini /data/tcast_beta/ch${x}/nba.ini
sed -i "s#18888#10$((x-1))3#" /data/tcast_beta/ch${x}/nba.ini
sed -i "s#18881#10$((x-1))1#" /data/tcast_beta/ch${x}/nba.ini
sed -i "s#18882#10$((x-1))2#" /data/tcast_beta/ch${x}/nba.ini
sed -i "s#nba#yc${x}#" /data/tcast_beta/ch${x}/nba.ini
done
for i in 11 12 13 14 15 16 17 18 19 20 ;do
chown -R web:web /data/tcast_beta/ch${i}
done
rm -f /root/yc*
rm -f /root/p2pstart*
wget
rm -f /tmp/p2pstart*
mv /root/p2pstart.sh /tmp/p2pstart.sh
chmod +x /tmp/p2pstart.sh
sudo -u web /bin/sh /tmp/p2pstart.sh
阅读(876) | 评论(0) | 转发(0) |