Monitor website status with curl
When a desired website is down or a new website is about to become available, one can use the “curl” program to check the status of the website HTTP response code. Using a periodic check with watch program one can monitor the status for an extended period of time. Keep in mind that the website might have anti-DOS measures that block repeated requests from the same IP address. Set “watch” interval and maximum number of requests to avoid being blocked.
Use a command like the following to check every 60 seconds for up to 60 times (1 hour):
watch -n 60 -q 60 curl -s -w %{response_code} -o /dev/null URLCurl command reference:
curl -s -w %{response_code} -o /dev/null URL-o /dev/null- discard the webpage content to avoid screen clutter. On Windows, use
-o NULinstead. -s- silent mode
-w %{response_code}- write the HTTP response code to console
URL- the desired URL to check