Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tip

If you want the scripts to run automatically read up on cron.

Check for Webpage Change

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".

Code Block
languagebash
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.

Scripts

Page Tree