nginx-certbox/health_check.sh

15 lines
455 B
Bash
Executable File

#!/usr/bin/env bash
TIMEOUT=2
function no_good {
cd /home/kkenny/src/docker/nginx-certbot
echo "[$(date)] $1 has failed, restarting." >> health.log
docker compose down >> health.log 2>&1
docker compose up -d >> health.log 2>&1
exit 1
}
curl -s --connect-timeout $TIMEOUT https://kameronkenny.com >/dev/null 2>&1 || no_good "kameronkenny.com"
curl -s --connect-timeout $TIMEOUT https://thelinux.pro >/dev/null 2>&1 || no_good "thelinux.pro"