Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
伺服器自我檢查網站健康度
#!/bin/bash
now="$(date +"%c")"
statuscode=`wget --spider -S "https://www.mxp.tw" 2>&1 | grep "HTTP/" | awk '{print $2}'`
if [ "$statuscode" != "200" ]
then
sudo /path/to/server restart
echo "restart in $now">>/home/username/crush_log.txt;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.