add health check
This commit is contained in:
parent
53c07e85a7
commit
46fbb63489
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
TIMEOUT=2
|
||||||
|
|
||||||
|
function no_good {
|
||||||
|
cd /home/kkenny/src/docker/pihole
|
||||||
|
git pull
|
||||||
|
echo "[$(date)] $1 has failed, restarting." >> health.log
|
||||||
|
docker compose down >> health.log 2>&1
|
||||||
|
docker compose up $1 -d >> health.log 2>&1
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
case $(hostname) in
|
||||||
|
pi501)
|
||||||
|
dig google.com @10.200.53.241 >/dev/null 2>&1 || no_good "pihole1"
|
||||||
|
;;
|
||||||
|
pi502)
|
||||||
|
dig google.com @10.200.53.242 >/dev/null 2>&1 || no_good "pihole2"
|
||||||
|
;;
|
||||||
|
pi503)
|
||||||
|
dig google.com @10.200.53.243 >/dev/null 2>&1 || no_good "pihole3"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
Loading…
Reference in New Issue