Created
August 15, 2020 11:40
-
-
Save jftuga/48e008acf7c5e24dbca002311d88cea7 to your computer and use it in GitHub Desktop.
Update block lists in a dockerized version of PiHole
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Update block lists in a dockerized version of PiHole | |
# the log file should be: update_pihole_block_lists.log | |
# | |
# run this script from cron each Saturday morning with this contab entry: | |
# 00 3 * * 6 /root/update_pihole_block_lists.sh | |
IMAGE=pihole | |
LENGTH=12 | |
LOG="${0%.*}.log" | |
CONTAINER=$(docker ps --format "{{.ID}}" --filter name=${IMAGE}) | |
if [ "${#CONTAINER}" -ne "${LENGTH}" ] ; then | |
echo "No running container for image: ${IMAGE}" | |
exit 1 | |
fi | |
echo >> ${LOG} | |
echo >> ${LOG} | |
echo >> ${LOG} | |
echo "==============================================================" >> ${LOG} | |
date >> ${LOG} | |
echo "==============================================================" >> ${LOG} | |
docker exec -t ${CONTAINER} pihole updateGravity >> ${LOG} 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment