(OS X) Watch a URL and display a Notification Center notification when the URL has changed
#!/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