Created
December 2, 2013 13:26
-
-
Save pajp/7749399 to your computer and use it in GitHub Desktop.
(OS X) Watch a URL and display a Notification Center notification when the URL has changed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] ; then | |
echo "Supply a URL to watch." | |
exit 1 | |
fi | |
tempfile1=`mktemp -t urlwatch` | |
tempfile2=`mktemp -t urlwatch` | |
curl "$1" > $tempfile2 | |
cat $tempfile2 | |
cp $tempfile2 $tempfile1 | |
echo | |
echo --- | |
while diff -q $tempfile1 $tempfile2 ; do | |
curl -s "$1" > $tempfile1 | |
sleep 5 | |
done | |
echo | |
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