The ping command is usually used to test the accessibility of a server. But it can happen, that a ping command is successfully executed, the corresponding website cannot be reached. To test this case, I wrote a little script, that tried with wget, go to the website.

#!/bin/bash
# Check site every 10 seconds, log failed connection attempts in siteuptime.txt
while true; do
echo "Checking site...";
/usr/bin/wget "Domain To Test" --timeout 1 -O - 2>/dev/null | grep "Website Searchstring " || echo "The site is down" | date --iso-8601=seconds >> /The/Output/File.txt;
sleep 1;
done