furmeet-bot/check_sanity.sh

29 lines
915 B
Bash
Executable File

#!/bin/bash
curl -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 http://127.0.0.1:34891/ping 2>/dev/null | grep "pong" 1>/dev/null
if [ $? != 0 ]; then
echo "Cannot hear a pong from local socket. Restarting Furmeet Bot... "
systemctl restart furmeet-bot
systemctl restart furmeet-bot-bg-tasks
fi
curl https://bot.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 https://bot.furmeet.app/ping 2>/dev/null | grep "pong" 1>/dev/null
if [ $? != 0 ]; then
echo "Cannot hear ping from web. Restarting Bot Events and NGINX... "
systemctl restart nginx
systemctl restart furmeet-bot
systemctl restart furmeet-bot-bg-tasks
fi