Last active
May 27, 2024 18:46
-
-
Save thomasmerz/ee6d401fdb09dbd607e8f0015436a2bd to your computer and use it in GitHub Desktop.
this script can be used to auto-update your pi-hole docker instance
This file contains hidden or 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 | |
need_restart=no | |
# --- | |
function restart_pihole() { | |
cd /root/pihole && { | |
docker-compose --ansi never pull 2>&1 | |
docker-compose --ansi never stop && docker-compose --ansi never up -d | |
} | |
} | |
# --- | |
# --- | |
function check_for_image() { | |
cd /root/pihole && | |
docker-compose --ansi never pull 2>&1 | grep "is up to date" || need_restart=yes | |
} | |
# --- | |
# --- | |
# MAIN | |
# --- | |
check_for_image | |
[ "$need_restart" == "yes" ] && restart_pihole | |
# --- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment