New backup 2025-03-19 14:45:02
This commit is contained in:
parent
d6325a7ded
commit
0d98d5d30b
1 changed files with 7 additions and 6 deletions
|
@ -3,14 +3,15 @@
|
|||
wttr_cache="${HOME}/.cache/wttr.json"
|
||||
|
||||
if [[ ! $(find "${wttr_cache}" -cmin -60 -print 2>/dev/null) ]]; then
|
||||
# echo "File ${wttr_cache} exists and is younger than 60min"
|
||||
#else
|
||||
# echo "File ${wttr_cache} does not exists or is younger than 60min"
|
||||
curl --silent wttr.in/Eugene?format=j1 > "${wttr_cache}"
|
||||
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
|
||||
fi
|
||||
|
||||
#cat "${wttr_cache}"
|
||||
|
||||
condition="$(jq -r '.current_condition[0].weatherDesc[0].value' ${wttr_cache})"
|
||||
condition_code="$(jq -r '.current_condition[0].weatherCode' ${wttr_cache})"
|
||||
current_temp="$(jq -r '.current_condition[0].temp_F' ${wttr_cache})"
|
||||
|
|
Loading…
Add table
Reference in a new issue