The Black Friday Obsession
This Black Friday shopping thing is just totally weird when you step back and take a look at it. I have a really hard time understanding the appeal of standing in line in the cold, hours on end to save a few bucks. However, over the last few years, the phenomenon has become more prominent online as well. While I refuse to fight the crowds and cold, I am much more willing to fight the cyber crowd for a deal.
Since I already had cygwin installed on my PC, I devised my own bash script to do the work for me. Please be forewarned, I’m not a bash script guru, and it was already late when wrote it, so it’s quick and dirty.
Basically, it uses wget to grab the html for the product page. Then I grep the page for the product name. This is to make sure that I’m not getting a server error their site tends to get overloaded on BF for some reason
Grep returns a ‘0′ if it found the string, ‘1′ if it did not.
I wish there was a happy ending to the story, but in they never put up any more stock. However, I did get to sleep in.
#!/bin/bash
while [ 1 ]; do
rm bb-mag-monitor.html
wget -O bb-mag-monitor.html <url of item> &> /dev/null
#Make sure the name is there in case the site is down
grep -c “Flat-Panel” bb-mag-monitor.html &> /dev/null
#get the return code
check1=$?
grep -c “Sold Out” bb-mag-monitor.html &> /dev/null
#get the return code
check2=$?
#grep returns 0 if found 1 if not
#if product name found and “Sold Out” not found
if [ “$check1″ = “0″ ]; then
if [ “$check2″ = “1″ ]; then
# We found it.. start making noise every 15s
while [ 1 ]; do
cat “HELPYOU.WAV” > /dev/dsp
sleep 15s
done
else
echo `date` Monitor Out of Stock
fi
else
echo `date` Monitor Desc Not Found
fi
#try again in 3 minutes
sleep 3m
done
November 27th, 2006 at 2:20 pm
Beauty! I think the sleeping in part is a happy ending in and of itself.
November 27th, 2006 at 5:23 pm
This is brilliant! Keep up the good work! Never knew you could cat a wav file to /dev/dsp
sweet.