From 2877c17bf58f4047b637521d5c9461bc8e542160 Mon Sep 17 00:00:00 2001 From: gently Date: Sat, 14 Dec 2019 21:29:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=89=A7=E8=A1=8C=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=EF=BC=8C=E5=AE=8C=E5=96=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- start.sh | 8 +++++++- tools/research-addr.php | 2 +- tools/start-research.sh | 7 +++++++ tools/{start.sh => start-valid.sh} | 1 + tools/valid-addr.php | 2 +- 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100755 tools/start-research.sh rename tools/{start.sh => start-valid.sh} (93%) diff --git a/start.sh b/start.sh index 6dd2d70d..e8b9ee40 100755 --- a/start.sh +++ b/start.sh @@ -8,6 +8,7 @@ git pull echo '开始下载 easylist1...' wget -O ./origin-files/easylistchina+easylist.txt --timeout 30 https://easylist-downloads.adblockplus.org/easylistchina+easylist.txt +# shellcheck disable=SC2181 if [ $? -ne 0 ];then echo '下载失败,请重试' exit 1 @@ -16,6 +17,7 @@ fi echo '开始下载 easylist2...' wget -O ./origin-files/cjx-annoyance.txt --timeout 30 https://raw.githubusercontent.com/cjx82630/cjxlist/master/cjx-annoyance.txt +# shellcheck disable=SC2181 if [ $? -ne 0 ];then echo '下载失败,请重试' exit 1 @@ -24,6 +26,7 @@ fi echo '开始下载 easylist3...' wget -O ./origin-files/fanboy-annoyance.txt --timeout 30 https://easylist.to/easylist/fanboy-annoyance.txt +# shellcheck disable=SC2181 if [ $? -ne 0 ];then echo '下载失败,请重试' exit 1 @@ -33,6 +36,7 @@ fi echo '开始下载 hosts1...' wget -O ./origin-files/hosts1 --timeout 30 https://hosts.nfz.moe/full/hosts +# shellcheck disable=SC2181 if [ $? -ne 0 ];then echo '下载失败,请重试' exit 1 @@ -41,6 +45,7 @@ fi echo '开始下载 hosts2...' wget -O ./origin-files/hosts2 --timeout 60 https://raw.githubusercontent.com/vokins/yhosts/master/hosts +# shellcheck disable=SC2181 if [ $? -ne 0 ];then echo '下载失败,请重试' exit 1 @@ -49,6 +54,7 @@ fi echo '开始下载 hosts3...' wget -O ./origin-files/hosts3 --timeout 60 https://raw.githubusercontent.com/jdlingyu/ad-wars/master/hosts +# shellcheck disable=SC2181 if [ $? -ne 0 ];then echo '下载失败,请重试' exit 1 @@ -57,6 +63,6 @@ fi PHP_RET=$(/usr/local/php/bin/php make-addr.php) -git add -A adblock-for-dnsmasq.conf hosts1 hosts2 host3 *.txt +git add -A adblock-for-dnsmasq.conf origin-files/* git commit -am "auto commit. script output--- $PHP_RET" git push --force diff --git a/tools/research-addr.php b/tools/research-addr.php index 59694bb9..bf18e9ec 100644 --- a/tools/research-addr.php +++ b/tools/research-addr.php @@ -79,5 +79,5 @@ while(!feof($src_fp)){ //删除之前验证工具生成的中间结果 foreach(array_merge($china_list_files, $dead_horse_files) as $f){ -// unlink($f); + unlink($f); } diff --git a/tools/start-research.sh b/tools/start-research.sh new file mode 100755 index 00000000..f28ee47f --- /dev/null +++ b/tools/start-research.sh @@ -0,0 +1,7 @@ +#!/bin/bash +#每周运行一次 + +source /etc/profile +cd $(cd "$(dirname "$0")";pwd) + +nohup php research-addr.php >> ./std-research.out & \ No newline at end of file diff --git a/tools/start.sh b/tools/start-valid.sh similarity index 93% rename from tools/start.sh rename to tools/start-valid.sh index 72b36324..3346cdec 100755 --- a/tools/start.sh +++ b/tools/start-valid.sh @@ -1,4 +1,5 @@ #!/bin/bash +#每天运行一次 source /etc/profile cd $(cd "$(dirname "$0")";pwd) diff --git a/tools/valid-addr.php b/tools/valid-addr.php index da2f93f4..02adb591 100644 --- a/tools/valid-addr.php +++ b/tools/valid-addr.php @@ -111,4 +111,4 @@ try{ echo date('m-d H:i:s'), "write file failed:", $e->getMessage(), "\t", $e->getCode(), "\n"; } -echo 'Time cost:', microtime(true) - START_TIME, "s, at", date('m-d H:i:s'), "\n"; +echo 'Time cost:', microtime(true) - START_TIME, "s, at ", date('m-d H:i:s'), "\n";