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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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.

The following script checks a page and will send 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