File tree 2 files changed +2
-19
lines changed
2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,6 @@ fetch_weather_information()
42
42
# get weather display
43
43
display_weather ()
44
44
{
45
- fahrenheit=$1
46
45
if $fahrenheit ; then
47
46
display_weather=' &u' # for USA system
48
47
else
@@ -74,24 +73,13 @@ forecast_unicode()
74
73
fi
75
74
}
76
75
77
- export -f display_weather
78
- export -f display_location
79
- export -f forecast_unicode
80
- export -f fetch_weather_information
81
-
82
76
main ()
83
77
{
84
78
# process should be cancelled when session is killed
85
79
if timeout 1 bash -c " </dev/tcp/ipinfo.io/443" && timeout 1 bash -c " </dev/tcp/wttr.in/443" ; then
86
- if ! weather=$( timeout 3 bash -c " display_weather $fahrenheit " ) ; then
87
- echo " Weather Unavailable"
88
- elif ! location=$( timeout 3 bash -c display_location) ; then
89
- echo " Location Unavailable"
90
- else
91
- echo " ${weather}${location} "
92
- fi
80
+ echo " $( display_weather) $( display_location) "
93
81
else
94
- echo " Network Error "
82
+ echo " Weather Unavailable "
95
83
fi
96
84
}
97
85
Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ fixedlocation=$3
11
11
DATAFILE=/tmp/.dracula-tmux-data
12
12
LAST_EXEC_FILE=" /tmp/.dracula-tmux-weather-last-exec"
13
13
RUN_EACH=1200
14
- RETRY_EACH=60
15
14
TIME_NOW=$( date +%s)
16
15
TIME_LAST=$( cat " ${LAST_EXEC_FILE} " 2> /dev/null || echo " 0" )
17
16
@@ -23,10 +22,6 @@ main()
23
22
# Run weather script here
24
23
$current_dir /weather.sh $fahrenheit $location " $fixedlocation " > " ${DATAFILE} "
25
24
echo " ${TIME_NOW} " > " ${LAST_EXEC_FILE} "
26
- elif grep -q ' Unavailable\|Error' " ${DATAFILE} " && [ " $( expr ${TIME_LAST} + ${RETRY_EACH} ) " -lt " ${TIME_NOW} " ]; then
27
- # Run weather script here
28
- $current_dir /weather.sh $fahrenheit $location " $fixedlocation " > " ${DATAFILE} "
29
- echo " ${TIME_NOW} " > " ${LAST_EXEC_FILE} "
30
25
fi
31
26
32
27
cat " ${DATAFILE} "
You can’t perform that action at this time.
0 commit comments