Skip to content

BraintoByte/Pi-Hole-Updater

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Pi Hole Updater

██████╗ ██████╗  █████╗ ██╗███╗   ██╗    ████████╗ ██████╗     ██████╗ ██╗   ██╗████████╗███████╗███████╗
██╔══██╗██╔══██╗██╔══██╗██║████╗  ██║    ╚══██╔══╝██╔═══██╗    ██╔══██╗╚██╗ ██╔╝╚══██╔══╝██╔════╝██╔════╝
██████╔╝██████╔╝███████║██║██╔██╗ ██║       ██║   ██║   ██║    ██████╔╝ ╚████╔╝    ██║   █████╗  ███████╗
██╔══██╗██╔══██╗██╔══██║██║██║╚██╗██║       ██║   ██║   ██║    ██╔══██╗  ╚██╔╝     ██║   ██╔══╝  ╚════██║
██████╔╝██║  ██║██║  ██║██║██║ ╚████║       ██║   ╚██████╔╝    ██████╔╝   ██║      ██║   ███████╗███████║
╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝╚═╝  ╚═══╝       ╚═╝    ╚═════╝     ╚═════╝    ╚═╝      ╚═╝   ╚══════╝╚══════╝

Description

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!


Dependencies

python -m pip install docker
python -m pip install dateutils

Install

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

Run

python pi_hole_updater.py

Download Pi-Hole NOW!

Pi-hole website
Network-wide ad blocking via your own Linux hardware

Pi-Hole Download





Check out our website, braintobytes.com for more!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages