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.

So, I had my eye on a 17″ LCD monitor for $80 at Best Buy. They were listing it as ‘Sold Out’ on Thursday, but I was hoping that they would put more stock up Friday morning. The big question was if they put more stock up, when would they? I could get up around 5 A.M., but shouldn’t my computer be able to check for me? Then wake me up only if it’s in stock?

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.

Next, I grep for the phrase “Sold Out.” If it is NOT found then I repeat playing a wave every 15 seconds… hopefully to wake me up. Every three minutes it attempt the whole process again, logging the result to the console after every iteration. The script needs to be terminated by a break from the console.

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.

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

grep -c "Sold Out" bb-mag-monitor.html &> /dev/null
#get the return code

#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
echo `date` Monitor Out of Stock
echo `date` Monitor Desc Not Found

#try again in 3 minutes
sleep 3m

This entry was posted in General, Programming. Bookmark the permalink.

2 Responses to The Black Friday Obsession

  1. Rob says:

    Beauty! I think the sleeping in part is a happy ending in and of itself.

  2. IronKurton says:

    This is brilliant! Keep up the good work! Never knew you could cat a wav file to /dev/dsp


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s