From 1d8cedf0a0a1f172513557bef2904f5d971be1ea Mon Sep 17 00:00:00 2001 From: David Garvey Date: Tue, 17 Sep 2024 11:05:28 +0200 Subject: [PATCH] allow licence_days_remaining to be global --- scripts/common.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index 6f6d83f2..50300ce9 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -292,8 +292,9 @@ check_licence_expiry () { local licence_expiry=$(echo $licence_payload | jq -r '.exp') # calculate the number of seconds remaining for the licence local licence_seconds_remaining=$(expr $licence_expiry - $(date '+%s')) - # calculate the number of days remaining for the licence (this sets a global variable, allowing the value to be used elsewhere) - local licence_days_remaining=$(expr $licence_seconds_remaining / 86400) + # calculate the number of days remaining for the licence + # do not make licence_days_remaining a local variable - this sets a global variable, allowing the value to be used elsewhere + licence_days_remaining=$(expr $licence_seconds_remaining / 86400) # check if licence time remaining (in seconds) is less or equal to 0 if [ "$licence_seconds_remaining" -le "0" ]; then