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 (

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

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:

# every 6 hour(s)
0 */6 * * * (date && URL="" QUERY="(Duffel)? ?(55|60|70)L" /path/to/ && echo '\n\n') >> /path/to/ 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 →