option to clear weather cache

This commit is contained in:
Noah Masur 2021-11-14 20:50:45 -05:00
parent 007ed17e71
commit 7a9e9b75c0

View File

@ -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" ]