ajout de la gestion des float
This commit is contained in:
parent
ed5d7d2d10
commit
7774c7d45b
|
|
@ -95,12 +95,17 @@ timeout 5 bash -c \
|
|||
# @return number of days left as int
|
||||
function getSSLExpireDayLeft()
|
||||
{
|
||||
# Get expire date
|
||||
EXPIRE=$(date -d "$(echo "QUIT" | openssl s_client -connect $1:$2 -servername $1 2>/dev/null | openssl x509 -text 2>/dev/null | grep 'Not After' | awk '{print $4,$5,$7}')" +%s);
|
||||
# Get today as
|
||||
TODAY=$(date +%s);
|
||||
# Return diff between expire and today
|
||||
echo $((($EXPIRE - $TODAY)/(3600*24)))
|
||||
# Get expire date
|
||||
EXPIRE=$(echo | openssl s_client -connect $1:$2 -servername $1 2>/dev/null \
|
||||
| openssl x509 -noout -enddate \
|
||||
| cut -d= -f2 \
|
||||
| xargs -I{} date -d "{}" +%s)
|
||||
|
||||
# Get today
|
||||
TODAY=$(date +%s)
|
||||
|
||||
# get diff as float
|
||||
echo "$EXPIRE $TODAY" | awk '{printf "%.3f jours\n", ($1-$2)/86400}'
|
||||
}
|
||||
|
||||
# ---
|
||||
|
|
|
|||
Loading…
Reference in New Issue