Introduction
Lists useful scripts using common Unix and Linux tools.
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".
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.