Patagonia Automagic™

Published October 29, 2019

I’m a bit of a Patagonia fan—especially their Worn Wear program. I’ve been looking at scooping up one of the Black Hole duffel bags1. I wanted to do some slight automation to see when items were added so I can hopefully grab them:

  1. request the webpage
  2. search for the specific item
  3. if that succeeded, send an email
    • probably also send an SMS

Those steps become a one-liner in a bash script (patagucci.sh):

#!/usr/bin/env bash
curl -s "$URL" | grep -i -E "$QUERY" && echo "$URL" | mail -s "$(date +%Y%m%d) [$QUERY]" my.email+fwd2sms@gmail.com

Notice the namespaced (+fwd2sms) email address. It’s one of my favorite underrated Gmail features. Using that namespace I can create a filter to automatically forward all emails sent to that address to my phone. This works by because my current carrier—AT&T—allows you to send SMS by using an email address formatted like .

To keep it simple I ran it on a cronjob executing every 6 hours:

# patagucci.sh-y every 6 hour(s)
0 */6 * * * (date && URL="https://wornwear.patagonia.com/shop/packs-and-gear" QUERY="(Duffel)? ?(55|60|70)L" /path/to/patagucci.sh && echo '\n\n') >> /path/to/patagucci.sh.log 2>&1

That’s it. Some EZPZ lemon squeeze-y automation.


  1. Of the current lineup I’d prefer the 55L or 70L. Ideally one of the older 60L models.↩︎

Last modified October 29, 2019  #dev   #hack   #bash 


← Newer post  •  Older post →