diff --git a/scripts/weather.sh b/scripts/weather.sh index 4b56c55f..d6461958 100755 --- a/scripts/weather.sh +++ b/scripts/weather.sh @@ -35,6 +35,7 @@ fetch_weather_information() #get weather display display_weather() { + fahrenheit=$1 if $fahrenheit; then display_weather='&u' # for USA system else @@ -66,13 +67,24 @@ forecast_unicode() fi } +export -f display_weather +export -f display_location +export -f forecast_unicode +export -f fetch_weather_information + main() { # process should be cancelled when session is killed if timeout 1 bash -c "/dev/null || echo "0") @@ -22,6 +23,10 @@ main() # Run weather script here $current_dir/weather.sh $fahrenheit $location "$fixedlocation" > "${DATAFILE}" echo "${TIME_NOW}" > "${LAST_EXEC_FILE}" + elif grep -q 'Unavailable\|Error' "${DATAFILE}" && [ "$(expr ${TIME_LAST} + ${RETRY_EACH})" -lt "${TIME_NOW}" ]; then + # Run weather script here + $current_dir/weather.sh $fahrenheit $location "$fixedlocation" > "${DATAFILE}" + echo "${TIME_NOW}" > "${LAST_EXEC_FILE}" fi cat "${DATAFILE}"