#!/bin/sh

#目录地址
Root=/opt/app
File=/adbyby
echo "adbyby_RootStrat" >> /opt/pid.txt
#启动命令
chmod 777 $Root$File/adbyby_RootStrat
cd $Root$File/data/
wget -O lazy.txt http://update.adbyby.com/rule3/lazy.jpg
wget -O video.txt http://update.adbyby.com/rule3/video.jpg
wget -O user.action http://update.adbyby.com/rule3/user.action
cd $Root$File/
#设置防火墙走adbyby
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8118
#启动adbyby
./adbyby_RootStrat&
huoqu=$(pgrep adbyby_RootStrat)
	jieguo=$( echo $huoqu | awk  ""'{print NF}')   
	if [ $jieguo = 0 ]; then
	#没有
         echo "插件并未运行"
    else
	#有
	echo "插件已运行"
    fi
done
