#!/bin/bash curl -m 10 -v http://127.0.0.1 2>&1 | grep 'Server: nginx/' 1>/dev/null if [ $? != 0 ]; then echo "Cannot reach NGINX home. Restarting NGINX... " systemctl restart nginx fi curl -m 10 http://127.0.0.1:61574/ping 2>/dev/null | grep "pong" 1>/dev/null if [ $? != 0 ]; then echo "Cannot hear a pong from local socket. Restarting Furmeet Events... " systemctl restart furmeet-events fi curl -m 10 https://events.furmeet.app/static/ping.txt 2>/dev/null | grep "pong" 1>/dev/null if [ $? != 0 ]; then echo "Cannot reach NGINX ping from web. Restarting NGINX... " systemctl restart nginx fi curl -m 10 https://events.furmeet.app/ping 2>/dev/null | grep "pong" 1>/dev/null if [ $? != 0 ]; then echo "Cannot hear ping from web. Restarting Furmeet Events and NGINX... " systemctl restart nginx systemctl restart furmeet-events fi