Created
July 31, 2016 14:01
-
-
Save acetwenty8/86788743f16770858513582eb775bcea 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 | |
#ESBcolor2email.sh | |
#@acetwenty8 7/31/2016 | |
#Script to send an email if ESB is not signature white tonight | |
TEMP=/tmp/`date +%s`.tmp | |
EML=/tmp/`date +%s`.eml | |
EMAILADDR=somewhere@nowhere.com | |
HTML=`curl -sq http://www.esbnyc.com/explore/tower-lights > $TEMP` | |
TODAY=`cat $TEMP | perl -ne 'print if s/\s+?<h1.*>(.*)<\/h1>/$1/g'` | |
TOMORROW=`cat $TEMP | tr -d '\n' | perl -ne 'print if s/.*<strong>Tomorrow<\/strong><p>(.*?)<\/p>.*/$1/g'` | |
YESTERDAY=`cat $TEMP | tr -d '\n' | perl -ne 'print if s/.*<strong>Yesterday<\/strong><p>(.*?)<\/p>.*/$1/g'` | |
echo $TODAY | grep -qi "signature white" | |
RV=$? | |
if [[ $RV -ne 0 ]]; then | |
#It's not white tonight | |
echo $TODAY | |
echo Tonight: $TODAY >> $EML | |
echo Tomorrow: $TOMORROW >> $EML | |
echo Yesterday: $YESTERDAY >> $EML | |
cat $EML | mail -s "ESB Color Tonight" $EMAILADDR | |
else | |
echo $TODAY | |
fi | |
rm -rf $TEMP | |
rm -rf $EML |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment