Created
October 2, 2012 21:30
-
-
Save metalrufflez/3823429 to your computer and use it in GitHub Desktop.
Script to parse and mail DirectLog tracking updates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script requirest 2 parameters | |
# $1 = Tracking Number | |
# $2 = Your mail address | |
# Didn't do a if check because I'm fat and lazy, deal with it | |
URL="http://www.directlog.com.br/track_individual/index.asp?flagOC=&fase=0&tipo=0&numtracking=$1" | |
BULK="$(curl -s "$URL" | egrep '<b>.*<br></b><br>' | tail -1 | sed -r "s/<(br|\/?b)>//g")" | |
CTLFILE=/tmp/ctldirect | |
test -z "$BULK" && exit 1 | |
if [ "$BULK" != "$(cat $CTLFILE)" ]; then | |
echo $BULK > $CTLFILE | |
mail -s "DirectLog Update $1" $2 < <(echo $BULK) | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment