#!/bin/bash while true; do rm -f onlineavailability.asp* # Wii at futureshop FS_file='onlineavailability.asp?sku_id=0665000FS10080745&test_cookie=1' FS_na_md5='3446893b21f720867a74a7cbccca044a,b47877a38b31c21b67007c332b94f252,19f78aab83b41b8b85388e8278b2058a' FS_url='http://www.futureshop.ca/catalog/proddetail.asp?logon=&langid=EN&sku_id=0665000FS10080745&catid=24713' if wget -q http://www.futureshop.ca/catalog/productdetail/onlineavailability.asp?sku_id=0665000FS10080745; then echo "`date -R`: Downloaded FS info." FS_md5=`md5sum "$FS_file" | cut -f 1 -d " "` else echo "`date -R`: Error Getting FS info." FS_md5='dl_error' fi # Wii at Bestbuy BB_file='onlineavailability.asp?sku_id=0926INGFS10080745&test_cookie=1' BB_na_md5='95018233818196b260ad1ee11f6881c0,302539caf343dddac93c2f0fbba87edb' BB_url='http://www.bestbuy.ca/catalog/proddetail.asp?logon=&langid=EN&sku_id=0926INGFS10080745&catid=24354' if wget -q http://www.bestbuy.ca/catalog/productdetail/onlineavailability.asp?sku_id=0926INGFS10080745; then echo "`date -R`: Downloaded BB info." BB_md5=`md5sum "$BB_file" | cut -f 1 -d " "` else echo "`date -R`: Error Getting BB info." BB_md5='dl_error' fi # For Test modes if [ x"$@" == x"--test-fs-md5" ]; then FS_na_md5='test...' fi if [ x"$@" == x"--test-bb-md5" ]; then BB_na_md5='test...' fi if [ x"$@" == x"--test-fs-grep" ]; then echo "iN StoCk" >> "$FS_file" fi if [ x"$@" == x"--test-bb-grep" ]; then echo "iN StoCk" >> "$BB_file" fi echo -e "\nChecking Future Shop:" if `grep -i "in stock" "$FS_file" > /dev/null`; then firefox -remote openURL\("$FS_url",new-tab\) || firefox "$FS_url" & mplayer song2.mp3 -msglevel all=-1 2>&1 > /dev/null & echo -e "\t`date -R`: Found Wii at FS (GREP)." else echo -e "\t`date -R`: No Wiis at FS (GREP)." f_FS_na_md5=`echo "$FS_na_md5" | sed -e 's/,/\\n\\t\\t\\t /g'` if ! `echo "$FS_na_md5" | grep "$FS_md5" > /dev/null` && [ "$FS_md5" != "dl_error" ]; then firefox -remote openURL\("$FS_url",new-tab\) || firefox "$FS_url" & mplayer song1.mp3 -msglevel all=-1 2>&1 > /dev/null & echo -e "\t`date -R`: Found Wii at FS (MD5SUM)." echo -e "\tMD5SUMS: \n\t\tCurrent: $FS_md5\n\t\tKnown NA: $f_FS_na_md5" else echo -e "\t`date -R`: No Wiis at FS (MD5SUM)." echo -e "\tMD5SUMS: \n\t\tCurrent: $FS_md5\n\t\tKnown NA: $f_FS_na_md5" fi fi echo -e "\nChecking BestBuy:" if `grep -i "in stock" "$BB_file" > /dev/null`; then firefox -remote openURL\("$BB_url",new-tab\) || firefox "$BB_url" & mplayer song2.mp3 -msglevel all=-1 2>&1 > /dev/null & echo -e "\t`date -R`: Found Wii at BB (GREP)." else echo -e "\t`date -R`: No Wiis at BB (GREP)." f_BB_na_md5=`echo "$BB_na_md5" | sed -e 's/,/\\n\\t\\t\\t /g'` if ! `echo "$BB_na_md5" | grep "$BB_md5" > /dev/null` && [ "$BB_md5" != "dl_error" ]; then firefox -remote openURL\("$BB_url",new-tab\) || firefox "$BB_url" & mplayer song1.mp3 -msglevel all=-1 2>&1 > /dev/null & echo -e "\t`date -R`: Found Wii at BB (MD5SUM)." echo -e "\tMD5SUMS: \n\t\tCurrent: $BB_md5\n\t\tKnown NA: $f_BB_na_md5" else echo -e "\t`date -R`: No Wiis at BB (MD5SUM)." echo -e "\tMD5SUMS: \n\t\tCurrent: $BB_md5\n\t\tKnown NA: $f_BB_na_md5" fi fi input="$@" if `echo "$input" | grep test > /dev/null`; then exit 0 fi echo; echo sleep 5m done