Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to get a reservation at State Bird Provisions
set -e
mail() {
echo "$@" |
/usr/bin/mail -a"From: Richard Crowley <r@rcrowley.org>" -s"State Bird Provisions" "1234567890@vtext.com"
echo "$(date): there was a reservation!" >&2
}
TMP="$(mktemp)"
trap "mail \"FAILURE\"; rm -f \"$TMP\"" EXIT INT QUIT TERM
while true
do
curl -sv "http://rez.urbanspoon.com/reservation/start/2086" >"$TMP" 2>&1
if ! grep -q "Unfortunately, there are no web reservations available for this restaurant at this time." "$TMP"
then mail "http://rez.urbanspoon.com/reservation/start/2086"
fi
if ! grep -q "HTTP/1.1 200 OK" "$TMP"
then mail "$(grep "^< HTTP/1.1" "$TMP" | cut -c"3-")"
fi
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.