Skip to content

Instantly share code, notes, and snippets.

@derrickj
Created April 5, 2012 01:23
Show Gist options
  • Save derrickj/2307166 to your computer and use it in GitHub Desktop.
Save derrickj/2307166 to your computer and use it in GitHub Desktop.
Send text and email when a certain web page contains the word "Open"
#!/bin/sh
# given url (arg 1), alert user when it contains "open"
if [ -z "$1" ]; then
echo "Usage: $0 <url>"
exit 1
fi
URL="$1"
if [ $(curl "${URL}" 2>/dev/null | grep -c 'Open') -ne "0" ]; then
echo "${URL} is open" | mail -s "Class is open!!!" <my-number>@txt.att.net
echo "${URL} is open" | mail -s "Class is open!!!" <my-email>
fi
* * * * * /path/to/alerter.sh "http://registrar.ucla.edu/schedule/detselect.aspx?termsel=12S&subareasel=COM+SCI&idxcrs=0131++++"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment