mirror of
https://gitlab.com/robocopAlpha/pihole_lists.git
synced 2026-05-19 02:59:08 -07:00
Writing essential stats to a log file
This commit is contained in:
parent
893cdc4523
commit
4f590e2934
4 changed files with 22 additions and 5 deletions
|
|
@ -1,6 +1,11 @@
|
|||
#!/usr/bin/env bash
|
||||
[[ -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
|
||||
if df | grep -c dropbox > /dev/null; then
|
||||
umount "${HOME_DIR}/dropbox" || sudo umount "${HOME_DIR}/dropbox"
|
||||
|
|
@ -16,7 +21,9 @@ rclone mount --daemon dropbox:blocklist "${HOME_DIR}/dropbox" --volname dropbox
|
|||
|
||||
|
||||
cd "${WRK_DIR}/"
|
||||
echo $(date +%d.%m.%y-%H:%M:%S) >| lastpull
|
||||
echo $(date +%d.%m.%y-%H:%M:%S) >| lastpull
|
||||
${catCMD} lastpull >> "${LOGFILE}"
|
||||
|
||||
|
||||
# Fetch blocklists
|
||||
bash "${WRK_DIR}/get_blocklists.sh"
|
||||
|
|
@ -36,7 +43,8 @@ wc -l MyBlocklist.txt
|
|||
|
||||
echo -e "\nAdding these to my own Blacklist: \n"
|
||||
${catCMD} blocked | rg -vIN "^[\\#]" | sd '\s+$' '' | sort -u | uniq >> MyBlocklist.txt
|
||||
echo -e " $(wc -l MyBlocklist.txt) unique domains. \n"
|
||||
echo -e " $(wc -l MyBlocklist.txt) unique domains. \n" | tee -a "$LOGFILE"
|
||||
echo -e " $(wc -l facebook_block.txt) unique domains. \n" | tee -a "$LOGFILE"
|
||||
|
||||
#-------
|
||||
# Clean-up
|
||||
|
|
@ -62,7 +70,7 @@ chmod 777 ./*
|
|||
# Moving to target
|
||||
echo "Moving blocklists to destination..."
|
||||
cd "${WRK_DIR}/"
|
||||
rsync -a --progress blocklists/* "${HOME_DIR}/dropbox/"
|
||||
rsync -a --progress blocklists/* "${HOME_DIR}/dropbox/" | tee -a "$LOGFILE"
|
||||
|
||||
echo "Final clean up..."
|
||||
umount "${HOME_DIR}/dropbox" || sudo umount "${HOME_DIR}/dropbox"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue