From 1e302f851d3ea18c658d5aeeaccca8b1ae06c8a9 Mon Sep 17 00:00:00 2001 From: Pfych Date: Sun, 1 Sep 2024 16:36:43 +1000 Subject: [PATCH] Handle null instead of zero for negative case --- .config/scripts/cron/seed-status.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.config/scripts/cron/seed-status.sh b/.config/scripts/cron/seed-status.sh index b752bdf..8a805cb 100755 --- a/.config/scripts/cron/seed-status.sh +++ b/.config/scripts/cron/seed-status.sh @@ -1,4 +1,5 @@ TIME=$(date +%s) +ALERT_GAP=86400 source /Users/noahheague/.config/scripts/util/secret.sh API_KEY=$(getSecret "/server/mac-mini-1/seed-api-key") @@ -10,7 +11,7 @@ SEED_COUNT=$(curl --request GET \ --header "X-API-Key: $API_KEY" \ | jq ".response.community.seeding") -if [ "$SEED_COUNT" -le "0" ]; then +if [ "$SEED_COUNT" = "null" ]; then if [ ! -f /tmp/seed-timestamp.txt ]; then echo $TIME > /tmp/seed-timestamp.txt; @@ -21,7 +22,7 @@ if [ "$SEED_COUNT" -le "0" ]; then fi; SAVED_TIME=$(cat /tmp/seed-timestamp.txt) - SAVED_TIME_PLUS=$(( $SAVED_TIME + 86400 )); + SAVED_TIME_PLUS=$(( $SAVED_TIME + $ALERT_GAP )); if [ $TIME -ge $SAVED_TIME_PLUS ]; then echo $TIME > /tmp/seed-timestamp.txt;