Robustness not needed anymore because of curl's --output, no more empty files

This commit is contained in:
appeasementPolitik 2023-08-18 21:21:44 +00:00 committed by GitHub
parent b0dbb1d1f6
commit 92d3560888
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ getforecast() { curl -sf "$url/$LOCATION" --output "$weatherreport" && touch "$w
# Forecast should be updated only once a day.
checkforecast() {
[ -s "$weatherreport" ] && [ "$(stat -c %y "$weatherreport" 2>/dev/null |
[ "$(stat -c %y "$weatherreport" 2>/dev/null |
cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ]
}

View File

@ -4,7 +4,7 @@
moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
[ -s "$moonfile" ] && [ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
[ "$(stat -c %y "$moonfile" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
{ [ -z "$(pgrep 'sb-moonphase' | tail -n +3)" ] &&
( until { [ "$(cat /sys/class/net/w*/operstate)" = 'up' ] || [ "$(cat /sys/class/net/e*/operstate)" = 'up' ]; } &&
curl -sf "wttr.in/?format=%m" --output "$moonfile" && touch "$moonfile"; do sleep 60; done &&