Created
December 31, 2015 04:08
-
-
Save jasonhancock/961c4cd5029332a1728e to your computer and use it in GitHub Desktop.
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 | |
ADDR='[email protected]' | |
PRODUCT_ID=2885 | |
TMP_FILE=/tmp/adafruit.tmp | |
wget -O $TMP_FILE -q https://www.adafruit.com/product/$PRODUCT_ID > /dev/null 2>&1 | |
TS=`date '+%Y-%m-%d %H:%M:%S'` | |
if [[ $? != 0 ]]; then | |
echo "$TS error downloading file" | |
exit 1 | |
fi | |
grep -i "OUT OF STOCK" $TMP_FILE > /dev/null 2>&1 | |
if [[ $? != 0 ]]; then | |
echo "$TS sending mail" | |
echo "adafruit in stock" | mail -s "adafruit in stock" $ADDR | |
else | |
echo "$TS not sending mail" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment