Skip to content

Commit

Permalink
allow licence_days_remaining to be global
Browse files Browse the repository at this point in the history
  • Loading branch information
davegarvey committed Sep 17, 2024
1 parent 77a839d commit 1d8cedf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1d8cedf

Please sign in to comment.