nws-forecast-mailer

fetch and deliver the NWS 48-hour forecast by email
git clone git://src.adamsgaard.dk/nws-forecast-mailer # fast
git clone https://src.adamsgaard.dk/nws-forecast-mailer.git # slow
Log | Files | Refs | README | LICENSE Back to index

fetch_and_mail.sh (679B)


      1 #!/bin/bash
      2 recipient=("andersd@riseup.net")
      3 latitude=40.330
      4 longitude=-74.5647
      5 zcode="NJZ012"
      6 
      7 function fetch {
      8     curl --location --silent \
      9         "http://f1.weather.gov/meteograms/Plotter.php?lat=${1}&lon=${2}&wfo=PHI&zcode=${3}&gset=20&gdiff=10&unit=0&tinfo=EY5&ahour=0&pcmd=11011111111110100000000000000000000000000000000000000000000&lg=en&indu=3!1!1!&dd=&bw=&hrspan=48&pqpfhr=6&psnwhr=6"\
     10         --output $1-$2-$3-48h.png
     11 }
     12 
     13 fetch $latitude $longitude $zcode
     14 
     15 for i in "${recipient[@]}"
     16 do
     17     echo "Weather forecast for $latitude $longitude $zcode" | \
     18         mutt -F muttrc -a "$latitude-$longitude-$zcode-48h.png" \
     19         -s "NWS 48h forecast: $zcode" -- $i
     20 done