-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcheck-maps.sh
executable file
·27 lines (27 loc) · 968 Bytes
/
check-maps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
cd /tmp
rm -f blarg.png
HOUR=`date +%H`
if [ "$HOUR" -le 3 ] ; then
INITHOUR=0600
YYYYMMDD=`date --date="now - 1 day" +%Y-%m-%d`
elif [ "$HOUR" -le 14 ] ; then
INITHOUR=1800
YYYYMMDD=`date --date="now - 1 day" +%Y-%m-%d`
else
INITHOUR=0600
YYYYMMDD=`date +%Y-%m-%d`
fi
echo Run was $YYYYMMDD $INITHOUR
YYYYMMDDHH=`date --date="$YYYYMMDD $INITHOUR + 47 hours" +%Y-%m-%d_%H00`
YYYYMMDD=`date --date="$YYYYMMDD $INITHOUR + 47 hours" +%Y-%m-%d`
echo Checking run results at $YYYYMMDDHH
wget --quiet --output-document=blarg.png http://canadarasp.com/map-pngs/hrdps/latest/$YYYYMMDD/-122:-120:48:50/sfcwind3_$YYYYMMDDHH.vector.png
if [ -f blarg.png ] && [ "`stat -c %s blarg.png`" -gt 0 ]; then
echo "Map available, good"
aws cloudwatch put-metric-data --namespace canadarasp --metric-name hrdps_maps --value 1
else
echo "Map not available, bad"
aws cloudwatch put-metric-data --namespace canadarasp --metric-name hrdps_maps --value 0
fi
rm -f blarg.png