Hunter Ford Hunter Ford

Half-Off Depot ‘Notify When Back In Stock’

Half-Off Depot is great! You can find a lot of restaurants or services and get gift cards or certificates for half off the actual price. No gimmicks. One problem is that everything sells out so fast! And I never know when things come back in stock. There's a "feature" where you can be notified when things come back in stock, but it just doesn't work. So... to solve the problem I came up with a little script that will scrape the site for the different gift cards I'm looking out for at specified intervals and send me an email. It's not perfect, but it does the trick for now.

#!/bin/bash

NUM_AVAILABLE=`curl -s http://halfoffdepot.com/atlanta/categories/restaurants/all-restaurants/5-seasons-brewing-company.html | grep '</h1></span>' | sed -e 's/^.*;">//' -e 's/<\/.*$//'`

if [ $NUM_AVAILABLE -ne 0 ]
then
    echo "http://halfoffdepot.com/atlanta/categories/restaurants/all-restaurants/5-seasons-brewing-company.html" | mail -s "There are $NUM_AVAILABLE gift cards available for 5 Seasons." "Your Name <user@domain.com>"
else
    echo "No gift cards available for 5 Seasons." && echo
fi

You can just replace the link with the one you're trying to target, and replace your email address. I have this running as a cron job daily at 8am,12pm, and 6pm. It's not perfect because the script doesn't check for a duplicate email, but things tend to sell-out fast, so I only usually get 2-3 emails

0 8,12,18 * * * /scripts/halfoff > /dev/null 2>&1