From 7a9e9b75c0fe02212aaedbb8f0be91e6dcd1c1f6 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sun, 14 Nov 2021 20:50:45 -0500 Subject: [PATCH] option to clear weather cache --- bin/weather_cached | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/weather_cached b/bin/weather_cached index d6cd923..d824bf1 100755 --- a/bin/weather_cached +++ b/bin/weather_cached @@ -1,7 +1,12 @@ #!/bin/sh -CACHE_FILE="$HOME/.cache/.weather_cache" -CACHE_TIME="$(stat -f %m "$CACHE_FILE")" +CACHE_FILE="$HOME/.cache/weather_cache" + +if [ "$1" = "clear" ]; then + rm -f "$CACHE_FILE" +fi + +CACHE_TIME="$(stat -f %m "$CACHE_FILE" 2>/dev/null)" NOW_TIME=$(date +%s) TIME_PASSED=$((NOW_TIME-CACHE_TIME)) if [ "$TIME_PASSED" -gt "1200" ]