Handle null instead of zero for negative case
This commit is contained in:
parent
e62f53732f
commit
1e302f851d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user