Skip to content

Instantly share code, notes, and snippets.

@shoaibali
Last active December 25, 2015 23:19
Show Gist options
  • Save shoaibali/7056269 to your computer and use it in GitHub Desktop.
Save shoaibali/7056269 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Written by Shoaib Ali [email protected]
# Paid by your tax money
# This script watches a site for changes by creating a md5 hash of it, if that hash changes means site/url is changed
# then it sends a notification via twitter. see twitter.sh
status=""
url=$1
keyword=$2
original_hash=`curl -s --compress --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.0 Safari/537.36" $url | openssl md5 | cut -d' ' -f2`
result=""
echo $original_hash
if [ $# -eq 0 ]
then
echo "No arguments supplied"
fi
# while $status is not null -z checks for null
while [ -n "$status"]
do
datetime=`date`
result=`curl -s --compress --user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.0 Safari/537.36" $url | openssl md5 | cut -d' ' -f2`
echo $result
if [ "$result" != "$original_hash" ]; then
# You need twitter shell script from here http://fanf.livejournal.com/108436.html
#~/tweet.sh "$datetime God dam $keyword $datetime"
echo "$datetime God dam $keyword $datetime"
exit
else
echo "No $keyword yet :( $result"
date
sleep 60
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment