Files
docker_compositions/grafana/auto_restart.sh
krumel fad036d559 .
2024-01-20 20:26:08 +00:00

17 lines
568 B
Bash
Executable File

#!/bin/bash
cd /home/admin/compose/grafana
response=$(curl --write-out '%{http_code}' --silent --output /dev/null https://grafana.krumel.moe)
if [[ $response -gt 500 ]] ; then
/usr/local/bin/docker-compose -f grafana.compose down > auto_restart.log 2>&1
/usr/local/bin/docker-compose -f grafana.compose up -d >> auto_restart.log 2>&1
sleep 1m
response=$(curl --write-out '%{http_code}' --silent --output /dev/null https://grafana.krumel.moe)
if [[ $response -gt 500 ]] ; then
echo "Auto Restart of Grafana/InfluxDB did not succeed, Status $response"
fi
fi