Ubuntu Pastebin

Paste from TJ at Sat, 2 Apr 2016 12:36:52 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
counter=1
text_minutes_ago=" minutes ago"
while [ $counter -lt 30 ]
do
    if [ $counter -eq 1 ]; then
        priortime=$(date -u -d '1 minute ago' +"%Y_%m_%d_%H_%M")
    else
        textpriortime="${counter}S{text_minutes_ago}"
        priortime=$(date -u -d "$textpriortime" +"%Y_%m_%d_%H_%M")
    fi
 
    thistimeexists=$(curl -s --max-time +2 --head "https://weather.gc.ca/data/radar/detailed/temp_image/WSO/WSO_PRECIP_SNOW_${priortime}.GIF" | head -n 1 | grep "HTTP/1.[01] [23]..")
 
    if [ x"${thistimeexists}" = x"" ]; then
        wget "https://weather.gc.ca/data/radar/detailed/temp_image/WSO/WSO_PRECIP_SNOW_${priortime}".GIF"
    else
        counter = 100
    fi
 
    counter=$((counter+1))
done
Download as text