I've done a script that check if the ipfilter.dat file is up to date. You can make a cron job to check it every week (simply put the script to /etc/cron.weekly/).
It's base on a file provide by www.bluetack.co.uk. If you know another ipfilter.dat more up to date, tell me

Code: Select all
#!/bin/bash
url="http://www.bluetack.co.uk/config/nipfilter.dat.gz"
tempDirectory="/tmp"
fileDirectory="/var/lib/qbittorrent/.local/share/data/qBittorrent"
tgzfile=$(basename $url)
NAME=$(basename $0)
#get local
wget $url -O $tempDirectory/$tgzfile -o /dev/null && \
gunzip $tempDirectory/$tgzfile
if [ $? != 0 ] ; then
echo "erreur wget & gunzip" 2>&1
rm $tempDirectory/$tgzfile
/usr/bin/logger -p local0.err "$NAME: Error: wget & gunzip"
exit 1
fi
#compare
if [ -e $fileDirectory/$(basename $tgzfile .gz) ] && [ $(md5sum $fileDirectory/$(basename $tgzfile .gz) | awk '{printf $1}') == $(md5sum $tempDirectory/$(basename $tgzfile .gz) | awk '{printf $1}') ] ; then
echo "same hash - no change"
rm $tempDirectory/$(basename $tgzfile .gz) && \
/usr/bin/logger -p local0.notice "$NAME: same md5 hash - no change" && \
exit 0
else
echo "different hash - update new"
cp $tempDirectory/$(basename $tgzfile .gz) $fileDirectory/$(basename $tgzfile .gz) && \
rm $tempDirectory/$(basename $tgzfile .gz) && \
/usr/bin/logger -p local0.notice "$NAME: success update new ipfilter IP list" && \
exit 0
fi
echo "erreur" 2>&1
exit 1