Skip to content

Commit

Permalink
chore(updatecli): change date detection for expiry and new certificat…
Browse files Browse the repository at this point in the history
  • Loading branch information
smerle33 authored Jan 17, 2024
1 parent 957df04 commit 8e1f345
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion updatecli/scripts/date_next_expiry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ fi
command -v "${DATE_BIN}" >/dev/null 2>&1 || { echo "ERROR: ${DATE_BIN} command not found. Exiting."; exit 1; }

# "${DATE_BIN}" --utc +"%Y-%m-%dT00:00:00Z" -d '+1 month' #keep for later use with allinone not alpine based
"${DATE_BIN}" -d@"$(( $(date +%s)+60*60*24*31))" --utc '+%Y-%m-%dT00:00:00Z'
"${DATE_BIN}" -d@"$(( $(date +%s)+60*60*24*30*3))" --utc '+%Y-%m-%dT00:00:00Z' # next expiry in around 3 month
4 changes: 2 additions & 2 deletions updatecli/scripts/datediff_expiry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ command -v "${DATE_BIN}" >/dev/null 2>&1 || { echo "ERROR: ${DATE_BIN} command n

currentdateepoch=$("${DATE_BIN}" --utc "+%s" 2>/dev/null)
expirydateepoch=$("${DATE_BIN}" "+%s" -d "$currentexpirydate" -D"%Y-%m-%dT00:00:00Z")
datediff=$(((expirydateepoch-currentdateepoch)/86400))
datediff=$(((expirydateepoch-currentdateepoch)/(60*60*24))) # diff per days

if [ "$datediff" -lt 10 ]
if [ "$datediff" -lt 10 ] # launch renew 10 days before expiration
then
echo "time for update"
exit 0
Expand Down

0 comments on commit 8e1f345

Please sign in to comment.