#!/path/to/bin/bash # dell-order-status: # check for changes in a Dell Order Status. # The URI is best grabed from the HTML email. # # # Some notes/comments on this script (documentation, perhaps) # http://tanqueray.amyl.org.uk/~adam/blog/2008/07/dell-order-checking-via-cron/ # # # Adam McGreggor , 2008 # # # Some rights reserved. # Licensed as: # Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales # http://creativecommons.org/licenses/by-nc-sa/2.0/uk/ # # $Id: dell-order-status,v 1.2 2008/07/31 22:16:43 adam Exp $ # # Variables, this makes it easier URI="http://support.euro.dell.com/support/order/emea/OrderStatus.aspx?c=uk&l=en&s=gen&ir=AB0123-1234-12345&ea=foo@example.org" file1=~/tmp/order-status.new file2=~/tmp/order-status subj="Change in Dell Order Status!" mailto="foo@example.org,baa@example.com" set -e cd ~/tmp wget -q ${URI} -O ${file1} if [ -e ${file2} ] ; then if ! diff ${file2} ${file1} > /dev/null ; then echo 'Getting Closer to a New Laptop' echo '' diff -u ${file2} ${file1} || echo "continue" >/dev/null mv ${file1} ${file2} mailx -s "${subj}" ${mailto} < ${file2} else rm ${file1} fi else mv ${file1} ${file2} mailx -s "${subj}" ${mailto} < ${file2} fi