From 293ce01383ba6910c23776ad10b86713d3551125 Mon Sep 17 00:00:00 2001 From: Dane Williams Date: Sun, 15 Mar 2020 10:18:59 -0700 Subject: [PATCH] more elegant response to too many requests --- sleep_weather.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sleep_weather.sh b/sleep_weather.sh index e2088e1..71e0174 100755 --- a/sleep_weather.sh +++ b/sleep_weather.sh @@ -4,10 +4,14 @@ main() { - while true + while tmux has-session &> /dev/null do ./weather.sh > ~/.tmux/plugins/tmux-dracula/weather.txt - sleep 600 + if [ (cat ~/.tmux/plugins/tmux-dracula/weather.txt | tail -1) = } ]; then + echo "Too Many Requests" > ~/.tmux/plugins/tmux-dracula/weather.txt + break + fi + sleep 1000 done }