aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.local/bin/barweather
diff options
context:
space:
mode:
Diffstat (limited to 'dotfiles/.local/bin/barweather')
-rwxr-xr-xdotfiles/.local/bin/barweather5
1 files changed, 4 insertions, 1 deletions
diff --git a/dotfiles/.local/bin/barweather b/dotfiles/.local/bin/barweather
index da8f25f..042fc52 100755
--- a/dotfiles/.local/bin/barweather
+++ b/dotfiles/.local/bin/barweather
@@ -10,7 +10,10 @@ if [ -n "$location" ]; then
fi
update_forecast() {
- ping -q -c 1 1.1.1.1 >/dev/null || exit
+ # Check several times before giving up, useful when just waking up from sleep
+ # since internet is usually not available right away
+ wget -q --tries=5 --timeout=20 --spider 1.1.1.1 > /dev/null || exit
+
forecast=$(curl -s wttr.in/"$location"?format=1)
if [ ${#forecast} -lt 30 ]; then
printf "%s\n" "$forecast" > "$cachefile"