From ed92060b268552b411910165056da195bdd7e9a3 Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Thu, 9 Oct 2025 13:30:01 -0700 Subject: [PATCH] New backup 2025-10-09 13:30:01 --- de/home/.config/eww/scripts/home/mcstatus | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) mode change 100644 => 100755 de/home/.config/eww/scripts/home/mcstatus diff --git a/de/home/.config/eww/scripts/home/mcstatus b/de/home/.config/eww/scripts/home/mcstatus old mode 100644 new mode 100755 index 42a2e7e..ba96bdf --- a/de/home/.config/eww/scripts/home/mcstatus +++ b/de/home/.config/eww/scripts/home/mcstatus @@ -1,13 +1,17 @@ #!/usr/bin/env bash mcstatus_cache="${HOME}/.cache/mcstatus.json" +server_list=("mc.pogmom.me" "mc.pogmom.me") -if [[ ! $(find "${mcstatus_cache}" -cmin -15 -print 2>/dev/null) ]]; then - if ! ping -w 15 -c 1 wttr.in;then - exit - fi - wttr_json=$(curl --silent wttr.in/Eugene?format=j1) - if [ "" != "${wttr_json}" ]; then - echo "${wttr_json}" | tee "${wttr_cache}" - fi +update_cache_json(){ + + for s in "${server_list[@]}";do + mcstatus "${s}" json + done | jq -n '.servers |= [inputs]' | tee "${mcstatus_cache}" >/dev/null +} + +if [[ ! $(find "${mcstatus_cache}" -cmin -5 -print 2>/dev/null) ]]; then + update_cache_json fi + +cat "${mcstatus_cache}"