Page tree
Skip to end of metadata
Go to start of metadata

Check for Webpage Change

This script does not yet run properly in a cron.

This is useful for example, to determine if a webpage has changed. For example, determine if a websites is down or if there is a price change on a website.

Provided mail is configured, the following script checks a page and sends an email if the contents of the page has the phrase, "Down for Maintenance".

curl websiteaddress.com | grep -q "Down for Maintenance"
if [ $? -eq 0 ] ; then
    echo "Website is Down. Script run at $(date)." | mail -s "Website is down for maintenance" email@address.com
fi

The grep -q tells grep to not output anything other than 0 if a match was found and 1 if no match was found.

  • No labels