From d19f92142531930d570d085796824fb757fe2971 Mon Sep 17 00:00:00 2001 From: Peter Schneider <36973164+pschneider1968@users.noreply.github.com> Date: Fri, 23 Dec 2022 05:43:19 +0100 Subject: [PATCH] Merge fix for #9 to master (#10) * Add boards.greenhouse.io to whitelist * Bump version to v0.3 * Set change date + number of blocked domains as of Dec 22, 2022 * Reformat/beautify README.md and help info in import_lists.sh * Reformat/beautify README.md and help info in import_lists.sh * Reformat/beautify README.md * Added pointers to relevant BSI documents to README.md * Added pointers to relevant BSI documents to README.md * Added pointers to relevant BSI documents to README.md * Added pointers to relevant BSI documents to README.md * Added pointers to relevant BSI documents to README.md * Added pointers to relevant BSI documents to README.md * Further improvement of the documentation in README.md * Revert "Bump version to v0.3" This reverts commit a923ca9375a068df353b9f84e0c2a8b902c9015f. * Fixed problems when refresh_all.sh is executed in cron job and /bin/sh is a symlink to /usr/bin/dash --- README.md | 2 +- refresh_all.sh | 36 +++++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 28af976..ac13250 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ For progress on this necessary enhancement, see also [Issue #7](https://github.c Install a crontab like this with `crontab -e` to regularly update from my repo at 0:40 AM in the night: - 40 0 * * * sh /etc/pihole/pihole-bl-msft-telemetry-bsi/refresh_all.sh merge + 40 0 * * * /bin/bash /etc/pihole/pihole-bl-msft-telemetry-bsi/refresh_all.sh merge The big domain blocklist from file `list_of_blocklists.txt` as well as the blacklists and whitelists are diff --git a/refresh_all.sh b/refresh_all.sh index 56d0639..f9bc530 100644 --- a/refresh_all.sh +++ b/refresh_all.sh @@ -7,28 +7,34 @@ LOG_FILE="/var/log/pihole/refresh_pihole_lists.log" GIT_STATUS_CMD="git status" GIT_PULL_CMD="git pull --no-rebase" REFRESH_SCRIPT="import_lists.sh $1" +SHELL=/bin/bash -touch $LOG_FILE +if [[ ! ":$PATH:" == *":/usr/local/bin:"* ]]; then + PATH=/usr/local/bin:$PATH +fi -echo -------------------------------------------------- | tee -a $LOG_FILE | cat -echo Refreshing lists at $(date) | tee -a $LOG_FILE | cat -echo -------------------------------------------------- | tee -a $LOG_FILE | cat +touch $LOG_FILE -echo | tee -a $LOG_FILE | cat +echo "--------------------------------------------------" 2>&1 | tee -a $LOG_FILE | cat +echo "Refreshing lists at $(date) " 2>&1 | tee -a $LOG_FILE | cat +echo "--------------------------------------------------" 2>&1 | tee -a $LOG_FILE | cat +echo "" 2>&1 | tee -a $LOG_FILE | cat +echo "PATH=$PATH" 2>&1 | tee -a $LOG_FILE | cat +echo "" 2>&1 | tee -a $LOG_FILE | cat cd $MY_DIRECTORY -$GIT_STATUS_CMD | tee -a $LOG_FILE | cat +$GIT_STATUS_CMD 2>&1 | tee -a $LOG_FILE | cat -echo Pulling from remote repo... | tee -a $LOG_FILE | cat -$GIT_PULL_CMD | tee -a $LOG_FILE | cat -$GIT_STATUS_CMD | tee -a $LOG_FILE | cat +echo "Pulling from remote repo..." 2>&1 | tee -a $LOG_FILE | cat +$GIT_PULL_CMD 2>&1 | tee -a $LOG_FILE | cat +$GIT_STATUS_CMD 2>&1 | tee -a $LOG_FILE | cat -echo +echo "" 2>&1 | tee -a $LOG_FILE | cat -$SHELL $REFRESH_SCRIPT | tee -a $LOG_FILE | cat +$SHELL $REFRESH_SCRIPT 2>&1 | tee -a $LOG_FILE | cat -echo ------------------------------------------------- | tee -a $LOG_FILE | cat -echo Done refreshing lists at $(date) | tee -a $LOG_FILE | cat -echo ------------------------------------------------- | tee -a $LOG_FILE | cat +echo "-------------------------------------------------" 2>&1 | tee -a $LOG_FILE | cat +echo "Done refreshing lists at $(date) " 2>&1 | tee -a $LOG_FILE | cat +echo "-------------------------------------------------" 2>&1 | tee -a $LOG_FILE | cat -echo | tee -a $LOG_FILE | cat +echo "" 2>&1 | tee -a $LOG_FILE | cat