Padavan固件添加adbyby去广告功能

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

 在路由-》自定义脚本=》wan上下行启动后执行,添加下面脚本

#!/bin/sh

sleep 30

###Adbyby去广告脚本###
Adbyby=1
### 0关闭;1启动 ###


#####以下脚本请勿更改#####
if [ "$Adbyby" = "0" ]; then
killall -9 adbyby
iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8118
rm -rf /tmp/bin
logger -t "【Adbyby】" "adbyby已关闭"
fi

if [ "$Adbyby" = "1" ]; then
if [ ! -s "/tmp/bin/adbyby" ] ;then
logger -t "【Adbyby】" "adbyby启动中......"
cd /tmp
wget http://update.adbyby.com/download/7620n.tar.gz
tar -xzvf 7620n.tar.gz
rm -f 7620n.tar.gz
cd /tmp/bin
chmod 777 ./*
./adbyby& > /dev/null
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8118
logger -t "【Adbyby】" "adbyby启动成功"
fi

if [ -s "/tmp/bin/adbyby" ] ;then
iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8118
killall adbyby
sleep 3
/tmp/bin/adbyby& > /dev/null
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8118
fi

sleep 60

logger -t "【Adbyby】" "lazy更新: 更新时间: `sed -n '1p' /tmp/bin/data/lazy.txt | sed 's/^...................//' | sed -nr 's/......$//p' | sed 's/ \+/ /g'`"

sleep 30

logger -t "【Adbyby】" "video更新: 更新时间: `sed -n '1p' /tmp/bin/data/video.txt | sed 's/^...................//' | sed -nr 's/................................................$//p' | sed 's/ \+/ /g'`"

fi

如果需要定时更新的话,可以再计划任务里面添加

0 */6 * * * /etc/storage/post_wan_script.sh &

 

转载于:https://my.oschina.net/u/261479/blog/824993

你可能感兴趣的:(Padavan固件添加adbyby去广告功能)