From: Martin Pitt Date: Sat, 4 Oct 2025 04:26:24 +0000 (+0200) Subject: daytime-term: Tolerate curl failures X-Git-Url: https://piware.de/gitweb/?a=commitdiff_plain;h=b198df19b48c7ae83429608c829181cc852a19dc;p=bin.git daytime-term: Tolerate curl failures Fixes failure when disconnected or on broken network. --- diff --git a/daytime-term b/daytime-term index 51f9b82..c7f0c5f 100755 --- a/daytime-term +++ b/daytime-term @@ -10,7 +10,7 @@ elif [ "${1:-}" = "day" ]; then else # get daylight times at most once a day if [ ! -e "$DATA" ] || [ $(( `date +%s` - `stat -c %Y $DATA` )) -gt 86400 ]; then - curl --silent --show-error -o "$DATA" 'https://api.sunrise-sunset.org/json?lat=48.22&lng=10.54&formatted=0' + curl --silent --show-error --connect-timeout=5 -o "$DATA" 'https://api.sunrise-sunset.org/json?lat=48.22&lng=10.54&formatted=0' || true fi sunrise=$(jq -r .results.sunrise < ~/.cache/sunrise.json) sunset=$(jq -r .results.sunset < ~/.cache/sunrise.json)