Automated Pi-hole v6 Maintenance Script
Languages: 🇬🇧 English (this file) • 🇩🇪 Deutsch
Automated Pi-hole v6 maintenance script for Raspberry Pi OS (Bookworm/Trixie) with logging and health checks.
- APT update/upgrade/autoremove/autoclean
- Pi-hole update (
-up), gravity (-g), optional FTL restart (--restart-ftl) - Health checks: port 53,
dig, GitHub reachability - Optional Tailscale info, FTL toplists via
sqlite3 - Performance dashboard & intelligent end-of-run summary
- Automatic local backup prior to Pi-hole changes
- Installer drops a weekly cron (
0 4 * * 0) out of the box (idempotent) - Logs in
/var/log/pihole_maintenance_pro_<timestamp>.log
Installer:
bash -c "$(curl -fsSL https://raw.githubusercontent.com/TimInTech/pihole-maintenance-pro/main/scripts/install.sh)"Use this to pull and overwrite with the latest release:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/TimInTech/pihole-maintenance-pro/main/scripts/install.sh)"/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/TimInTech/pihole-maintenance-pro/main/scripts/uninstall.sh)"These commands are idempotent: Update always replaces the installed script; Uninstall removes the script, logs, temp data, and the cron entry.
--no-apt– skips APT steps (update/upgrade/autoremove/autoclean)--no-upgrade– does not runpihole -up--no-gravity– skipspihole -g(blocklists/Gravity update)--no-dnsreload– deprecated in v6 (no-op)--restart-ftl– restart pihole-FTL at the end (v6: only if needed)--backup– creates a backup before Pi-hole ops under/var/backups/pihole/--json– outputs machine-readable JSON instead of the colored TUI
Manual installation:
cd ~
wget -O pihole_maintenance_pro.sh https://raw.githubusercontent.com/TimInTech/pihole-maintenance-pro/main/pihole_maintenance_pro.sh
chmod +x pihole_maintenance_pro.sh
sudo install -m 0755 pihole_maintenance_pro.sh /usr/local/bin/pihole_maintenance_pro.shInteractive usage:
sudo /usr/local/bin/pihole_maintenance_pro.shWith flags:
sudo /usr/local/bin/pihole_maintenance_pro.sh --no-apt --no-upgrade --no-gravity --no-dnsreloadCaptured on a Raspberry Pi with Pi-hole Core 6.1.4, Web 6.2.1, FTL 6.2.3 — this is the live dashboard + summary rendered by the current release:
╔═══════════════ PERFORMANCE DASHBOARD ═══════════════╗
║ 🚀 Load: 1.81 💾 RAM: 23% 🌡 Temp: 50°C 🗄 Disk: 9% ║
╚═══════════════════════════════════════════════════════╝
════════ INTELLIGENTE ZUSAMMENFASSUNG ════════
#00 🌍 Network IP: 192.168.178.21 ✔ OK
#03 🛡 Pi-hole v6.1.4 ✔ OK
#07 🔍 Health 4 listeners ✔ OK
#08 🌐 DNS Ext 172.217.16.78 ✔ OK
#09 🏠 DNS Local 127.0.0.1 ✔ OK
#12 📊 FTL Query 24h: 141222 queries, 1% blocked ✔ OK
#13 👥 FTL Client 25 active clients ✔ OKThe same production run confirms:
- Backups are created before Pi-hole maintenance kicks in (e.g.
/etc/pihole/backup_20251025_100315,/etc/pihole/backup_20251025_100337) - The installer provisions the recommended cron automatically:
0 4 * * 0 /usr/local/bin/pihole_maintenance_pro.sh >>/var/log/pihole_maint_cron.log 2>&1 - Security (Steps 20–26) and health checks (Steps 07–10) run green end-to-end
Recommended cron jobs:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
*/30 * * * * /usr/local/bin/pihole_api_healthcheck.sh >> /var/log/pihole_healthcheck.log 2>&1
30 3 * * * /usr/local/bin/pihole_maintenance_pro.sh >> /var/log/pihole_maintenance_pro.log 2>&1Trixie/cron runs with a reduced PATH. Using a full PATH ensures both scripts run reliably. The installer now sets the weekly cron idempotently.
setupVars.confis gone- Config lives in
/etc/pihole/pihole.toml - API is served at
/apiinstead of/api.php - Authentication uses session tokens:
POST /api/authreturnssid, pass via headerX-FTL-SID - The healthcheck script (
tools/pihole_api_healthcheck.sh) can hit endpoints whenPIHOLE_API_URLis set; setPIHOLE_PASSWORDto enable session login - Unbound is optional
-
sqlite3toplists:sudo apt update && sudo apt install -y sqlite3
-
Locale warnings:
echo -e "en_GB.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8" | sudo tee /etc/locale.gen >/dev/null sudo locale-gen && sudo update-locale LANG=de_DE.UTF-8 LC_ALL=de_DE.UTF-8
-
Pi 3B note about
linux-image-rpi-v8: ignorable on ARMv7.
MIT. See LICENSE.
Last updated: 2025-10-25 • Version: 5.3.2
If this project helps you, you can support it here: buymeacoffee.com/timintech