...
Lists useful scripts using common Unix and Linux tools. Most of these scripts are done in Ubuntu using the bash shell.
Tip |
---|
If you want the scripts to run automatically read up on cron and articles on adapting scripts to crons. |
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 | ||
---|---|---|
| ||
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.
This area should also include general tips for adapting to crons and when necessary also versions of the scripts modified for crons.
Also, I note unstructured real world examples here too prefixed by "Real World -". These also make good contest ideas for a scripting contest.
Scripts
Page Tree | ||
---|---|---|
|