hopefully fixed weather to now run every 10 minutes

This commit is contained in:
Dane Williams 2020-03-14 21:13:46 -07:00
parent 5c480613e7
commit bd64a45601
4 changed files with 26 additions and 2 deletions

View file

@ -37,6 +37,9 @@ main()
# message styling # message styling
tmux set-option -g message-style "bg=${gray},fg=${white}" tmux set-option -g message-style "bg=${gray},fg=${white}"
# run weather script in background
./sleep_weather.sh &
# status bar # status bar
tmux set-option -g status-style "bg=${gray},fg=${white}" tmux set-option -g status-style "bg=${gray},fg=${white}"
@ -44,7 +47,7 @@ main()
tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #(~/.tmux/plugins/tmux-dracula/battery.sh) " tmux set-option -g status-right "#[fg=${dark_gray},bg=${pink}] #(~/.tmux/plugins/tmux-dracula/battery.sh) "
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] tructus " tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] tructus "
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #() " tmux set-option -ga status-right "#[fg=${dark_gray},bg=${orange}] #(cat weather.txt) "
tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p #(date +%Z) " tmux set-option -ga status-right "#[fg=${white},bg=${dark_purple}] %a %m/%d %I:%M %p #(date +%Z) "
# window tabs # window tabs

15
sleep_weather.sh Executable file
View file

@ -0,0 +1,15 @@
#/usr/bin/env bash
#wrapper script for running weather on interval
main()
{
while true
do
./weather.sh
sleep 600
done
}
#run main driver function
main

View file

@ -57,8 +57,8 @@ display_weather()
main() main()
{ {
# process should be cancelled when session is killed
if ping -q -c 1 -W 1 ipinfo.io &>/dev/null; then if ping -q -c 1 -W 1 ipinfo.io &>/dev/null; then
echo "$(display_weather) $city, $(get_region_code)" echo "$(display_weather) $city, $(get_region_code)"
else else
echo "Location Unavailable" echo "Location Unavailable"

6
weather.txt Normal file
View file

@ -0,0 +1,6 @@
{
"error": {
"title": "Rate limit exceeded",
"message": "You've hit the daily limit for the unauthenticated API. Create an API access token by signing up to get 50k req/month."
}
}, { "error": { "title": "Rate limit exceeded", "message": "You've hit the daily limit for the unauthenticated API. Create an API access token by signing up to get 50k req/month." } }