██████╗ ██████╗ █████╗ ██╗███╗ ██╗ ████████╗ ██████╗ ██████╗ ██╗ ██╗████████╗███████╗███████╗
██╔══██╗██╔══██╗██╔══██╗██║████╗ ██║ ╚══██╔══╝██╔═══██╗ ██╔══██╗╚██╗ ██╔╝╚══██╔══╝██╔════╝██╔════╝
██████╔╝██████╔╝███████║██║██╔██╗ ██║ ██║ ██║ ██║ ██████╔╝ ╚████╔╝ ██║ █████╗ ███████╗
██╔══██╗██╔══██╗██╔══██║██║██║╚██╗██║ ██║ ██║ ██║ ██╔══██╗ ╚██╔╝ ██║ ██╔══╝ ╚════██║
██████╔╝██║ ██║██║ ██║██║██║ ╚████║ ██║ ╚██████╔╝ ██████╔╝ ██║ ██║ ███████╗███████║
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝
A very simple python script to update your pi-hole without having to change DNS everytime All the script does is:
- Pulls down latest pi-hole image
- Pulls and saves latest image
- Checks for latest image
- Purges all your docker container, images, volumes and networks to give you a clean slate (I ll remove that soon)
- Rebuilds the pi-hole docker image through
docker-compose
- Everything is logged with timestamps and a log UUID is produced for each run
For now, if you don't want to purge everything, you can just remove clean_docker(client)
at line 54
Note: If your pi-hole data is in a file system (like by default), you will NOT loose all your data If you are really worried once you do the initial setup backup your pi-hole data by going to: Settings -> Teleporter -> Backup in your pi-hole
Hope you enjoy!
python -m pip install docker
python -m pip install dateutils
First install dependencies above, check your python version and make sure you have pip
git clone [email protected]:BraintoByte/Pi-Hole-Updater.git
# As cron job
cd Pi-Hole-Updater/
touch pi_hole_job.sh
nano pi_hole_job.sh
Paste in this:
#!/bin/sh
cd "$(dirname "$0")";
CWD="$(pwd)"
echo $CWD
your_python_version pi_hole_updater.py
Use this to get your cron schedule: Crontab Guru
Then to add it to crontab:
* * * *_your_run_schedule your_path_to_job/pi_job.sh >> your_log_preferred_path/pi_job.log 2>&1
This will log all output, the python script logs all output with timestamps
Warning: Test it first! Depending on what distro and how you are running cron you might want to change with chmod
the folder cloned permissions
python pi_hole_updater.py
Network-wide ad blocking via your own Linux hardware
Check out our website, braintobytes.com for more!