mirror of
https://github.com/LukeSmithxyz/voidrice.git
synced 2025-10-07 07:22:36 +02:00
Only redirect non-empty output: for when services are down
This commit is contained in:
parent
de863bf0f0
commit
36d40adb8d
@ -7,7 +7,7 @@ url="${WTTRURL:-wttr.in}"
|
||||
weatherreport="${XDG_CACHE_HOME:-$HOME/.cache}/weatherreport"
|
||||
|
||||
# Get a weather report from 'wttr.in' and save it locally.
|
||||
getforecast() { curl -sf "$url/$LOCATION" > "$weatherreport"; }
|
||||
getforecast() { curl -sf "$url/$LOCATION" --output "$weatherreport"; }
|
||||
|
||||
# Forecast should be updated only once a day.
|
||||
checkforecast() {
|
||||
|
||||
@ -11,7 +11,7 @@ ipfile="$XDG_RUNTIME_DIR/iplocate"
|
||||
addr=$(cat "$ipfile" 2>/dev/null) && addr=$(geoiplookup "$addr" 2>/dev/null) && rm "$ipfile" ||
|
||||
{ [ -z "$(pgrep 'sb-iplocate' | tail -n +3)" ] &&
|
||||
( until { [ "$(cat /sys/class/net/w*/operstate)" = 'up' ] || [ "$(cat /sys/class/net/e*/operstate)" = 'up' ]; } &&
|
||||
curl -sf ifconfig.me > "$ipfile"; do sleep 60; done &&
|
||||
curl -sf ifconfig.me --output "$ipfile"; do sleep 60; done &&
|
||||
pkill -RTMIN+"${1:-27}" "${STATUSBAR:-dwmblocks}" ) &
|
||||
echo; exit; }
|
||||
name="${addr##*, }"
|
||||
|
||||
@ -7,7 +7,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')" ] ||
|
||||
{ [ -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" > "$moonfile"; do sleep 60; done &&
|
||||
curl -sf "wttr.in/?format=%m" --output "$moonfile"; do sleep 60; done &&
|
||||
pkill -RTMIN+"${1:-17}" "${STATUSBAR:-dwmblocks}" ) &
|
||||
echo; exit; }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user