-
Notifications
You must be signed in to change notification settings - Fork 0
/
forecastgrabber.sh
executable file
·66 lines (54 loc) · 2.13 KB
/
forecastgrabber.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
## This is the main script for the ECFORECASTGRABBER tool. If you're in here I hope you know what you're doing. :)
## Any issues, suggestions or contributions are welcome and can be made on github.
export LANGUAGE=UTF8
version="v3.4.0"
#Bring in config file variables.
. $(dirname "$0")/config.sh
#Some Temporary variables
tmp=tmp
finalForecasttmp="$tmp$finalForecast"
echo 'Running forecastgrabber.sh. Fetching XML feed.'
$wgetPath -O "$webPath/$xmlFile" $rssURL
## IF YOUR SYSTEM USES CURL COMMENT OUT THE PREVIOUS LINE AND UNCOMMENT THE FOLLOWING LINE
#/path/to/curl -o /your/location/ECXMLfile.txt https://weather.gc.ca/rss/city/bc-46_e.xml
#Export all the variables for perl
export perlversion=$version
export perlwebPath=$webPath
export perlxmlFile=$xmlFile
export perlenableIndigenous=$enableIndigenous
export perlenableTseshaht=$enableTseshaht
export perlenableMarine=$enableMarine
export perlforecastURL=$forecastURL
export perllatLong=$latLong
export perlforecastPlaceName=$forecastPlaceName
export perlwarnLink=$warnLink
export perlthunderLink=$thunderLink
export perlforecastName=$forecastName
export perlfinalForecast=$finalForecast
export perlfinalForecasttmp=$finalForecasttmp
export perlfreezeDrizzleWarn=$freezeDrizzleWarn
export perlfreezeRainWarn=$freezeRainWarn
export perlfreezingTemp=$freezingTemp
export perlnearfreezeTemp=$nearfreezeTemp
export perlhotTemp=$hotTemp
export perlexhotTemp=$exhotTemp
export perlexHumidex=$exHumidex
export perlthunderWarn=$thunderWarn
export perlboldDays=$boldDays
export perltextColor=$textColor
export perlflurriesColor=$flurriesColor
export perlfooterMsg=$footerMsg
export perlwindyColor=$windyColor
export perlhRainColor=$hRainColor
export perlvhRainColor=$vhRainColor
export perlwarningColor=$warningColor
export perlendedColor=$endedColor
echo 'running perl script'
## Running the perl script from the script directory to capture custom modules and with -C to ensure UTF-8 compliance.
cd $scriptPath
perl -C ./forecast.pl
## Copying the new file from temporary to final file and removing the temporary.
cp $webPath/$finalForecasttmp $webPath/$finalForecast
rm $webPath/$finalForecasttmp
echo 'done'