首页 > 服务器 > 自动更新aria2的bt-tracker列表
作者:ghostry 发布时间:2018-12-18 浏览: 8384
转载注明出处: https://blog.1ge.fun/server/892.html自动更新脚本如下
#!/bin/bash
/etc/init.d/aria2 stop
list=`wget -qO- https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt|awk NF|sed ":a;N;s/\n/,/g;ta"`
if [ ! $list ]; then
echo "list IS NULL"
else
if [ -z "`grep "bt-tracker=" /data/etc/aria2/aria2.conf`" ]; then
sed -i '$a bt-tracker='${list} /data/etc/aria2/aria2.conf
echo add......
else
sed -i "s@bt-tracker=.*@bt-tracker=$list@g" /data/etc/aria2/aria2.conf
echo update......
fi
fi
blacklist=`wget -qO- https://raw.githubusercontent.com/ngosang/trackerslist/master/blacklist.txt|sed "s:\s*#.*$::g"|awk NF|sed ":a;N;s/\n/,/g;ta"`
if [ ! $blacklist ]; then
echo "blacklist IS NULL"
else
if [ -z "`grep "bt-exclude-tracker=" /data/etc/aria2/aria2.conf`" ]; then
sed -i '$a bt-exclude-tracker='${blacklist} /data/etc/aria2/aria2.conf
echo add blacklist......
else
sed -i "s@bt-exclude-tracker=.*@bt-exclude-tracker=$blacklist@g" /data/etc/aria2/aria2.conf
echo update blacklist......
fi
fi
/etc/init.d/aria2 start
其中服务停止启动命令和配置文件地址自行替换,该脚本同时更新了附加服务器和排除服务器。
上一篇: 一年的流量下一篇: 安利一个项目smartdns