minor changes

- logs the number of items in individual blocklists (easier to troubleshoot)
- seting logfile in set_env
- unzip overwrites files while updating.
This commit is contained in:
robocopAlpha 2021-07-16 04:40:34 +03:00
parent 83c90411b7
commit 808b31d0d1
4 changed files with 9 additions and 9 deletions

View file

@ -65,7 +65,7 @@ if ping -c 1 -W 2 www.google.fi &> /dev/null ; then
rm -f tmp2.txt rm -f tmp2.txt
#-------- #--------
echo " #Lines FileName" echo " #Lines FileName"
wc -l *.txt wc -l *.txt | tee -a "$LOGFILE"
#-------- #--------
else else
echo "\n[!]Can't connect to the internet. Check your connectivity and try again.\n" echo "\n[!]Can't connect to the internet. Check your connectivity and try again.\n"

View file

@ -1,11 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
[[ -f set_env.sh ]] && source set_env.sh || { echo "set_env.sh not found"; exit 1; } [[ -f set_env.sh ]] && source set_env.sh || { echo "set_env.sh not found"; exit 1; }
LOGFILE="${WRK_DIR}/pull.log"
if [ ! -f "$LOGFILE" ] ; then
touch "$LOGFILE"
fi
# Mounting storage # Mounting storage
if df | grep -c dropbox > /dev/null; then if df | grep -c dropbox > /dev/null; then
umount "${HOME_DIR}/dropbox" || sudo umount "${HOME_DIR}/dropbox" umount "${HOME_DIR}/dropbox" || sudo umount "${HOME_DIR}/dropbox"

View file

@ -5,13 +5,13 @@ fetch_hosts(){
URL=$1 URL=$1
FNAME=$2 FNAME=$2
curl -sSL "${URL}" | rg -INv "^[#]|localhost" | sd '\s+$' '' | sd "^0\\.0\\.0\\.0 |^127\\.0\\.0\\.1 " "" | sd "\\#.*" "" >| ${FNAME} curl -sSL "${URL}" | rg -INv "^[#<]|localhost" | sd '\s+$' '' | sd "^0\\.0\\.0\\.0 |^127\\.0\\.0\\.1 " "" | sd "\\#.*" "" >| ${FNAME}
} }
fetch_blocklist(){ fetch_blocklist(){
URL=$1 URL=$1
FNAME=$2 FNAME=$2
curl -sSL "${URL}" | rg -INv "^[#]|localhost" | sd '\s+$' '' | sd "\\#.*" "" >| ${FNAME} curl -sSL "${URL}" | rg -INv "^[#<]|localhost" | sd '\s+$' '' | sd "\\#.*" "" >| ${FNAME}
} }
@ -48,3 +48,8 @@ else
fi fi
WRK_DIR=${HOME_DIR}/pihole_lists WRK_DIR=${HOME_DIR}/pihole_lists
LOGFILE="${WRK_DIR}/pull.log"
if [ ! -f "$LOGFILE" ] ; then
touch "$LOGFILE"
fi

View file

@ -38,7 +38,7 @@ if [ ! -f "$LOGFILE" ] ; then
fi fi
echo "pihole being udpdated on: $(date)" | tee -a "$LOGFILE" echo "pihole being udpdated on: $(date)" | tee -a "$LOGFILE"
curl -L 'https://www.dropbox.com/sh/oyjii6ndqduixt8/AADn57717lc0TE4AW5dxB0p4a?dl=1' --output ./blocklist.zip && unzip ./blocklist.zip curl -L 'https://www.dropbox.com/sh/oyjii6ndqduixt8/AADn57717lc0TE4AW5dxB0p4a?dl=1' --output ./blocklist.zip && unzip -o ./blocklist.zip
rm ./blocklist.zip rm ./blocklist.zip
xz -fd MyBlocklist.txt.xz xz -fd MyBlocklist.txt.xz
xz -fd facebook_block.txt.xz xz -fd facebook_block.txt.xz