Skip to content

Instantly share code, notes, and snippets.

@thomasmerz
Last active May 27, 2024 18:46
Show Gist options
  • Save thomasmerz/ee6d401fdb09dbd607e8f0015436a2bd to your computer and use it in GitHub Desktop.
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
#!/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