From b198df19b48c7ae83429608c829181cc852a19dc Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 4 Oct 2025 06:26:24 +0200 Subject: [PATCH] daytime-term: Tolerate curl failures Fixes failure when disconnected or on broken network. --- daytime-term | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) -- 2.47.3