Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
(OS X) Watch a URL and display a Notification Center notification when the URL has changed
if [ -z "$1" ] ; then
echo "Supply a URL to watch."
exit 1
tempfile1=`mktemp -t urlwatch`
tempfile2=`mktemp -t urlwatch`
curl "$1" > $tempfile2
cat $tempfile2
cp $tempfile2 $tempfile1
echo ---
while diff -q $tempfile1 $tempfile2 ; do
curl -s "$1" > $tempfile1
sleep 5
cat $tempfile1
osascript -e "display notification \"URL $1 changed.\""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment