Handle null instead of zero for negative case
This commit is contained in:
parent
e62f53732f
commit
1e302f851d
1 changed files with 3 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
TIME=$(date +%s)
|
TIME=$(date +%s)
|
||||||
|
ALERT_GAP=86400
|
||||||
|
|
||||||
source /Users/noahheague/.config/scripts/util/secret.sh
|
source /Users/noahheague/.config/scripts/util/secret.sh
|
||||||
API_KEY=$(getSecret "/server/mac-mini-1/seed-api-key")
|
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" \
|
--header "X-API-Key: $API_KEY" \
|
||||||
| jq ".response.community.seeding")
|
| jq ".response.community.seeding")
|
||||||
|
|
||||||
if [ "$SEED_COUNT" -le "0" ]; then
|
if [ "$SEED_COUNT" = "null" ]; then
|
||||||
if [ ! -f /tmp/seed-timestamp.txt ]; then
|
if [ ! -f /tmp/seed-timestamp.txt ]; then
|
||||||
echo $TIME > /tmp/seed-timestamp.txt;
|
echo $TIME > /tmp/seed-timestamp.txt;
|
||||||
|
|
||||||
|
@ -21,7 +22,7 @@ if [ "$SEED_COUNT" -le "0" ]; then
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
SAVED_TIME=$(cat /tmp/seed-timestamp.txt)
|
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
|
if [ $TIME -ge $SAVED_TIME_PLUS ]; then
|
||||||
echo $TIME > /tmp/seed-timestamp.txt;
|
echo $TIME > /tmp/seed-timestamp.txt;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue