#!/bin/bash
expire=$(echo | openssl s_client -servername easybiny.com -connect easybiny.com:443 2>/dev/null | openssl x509 -noout -dates | awk 'BEGIN{FS="After="} {print $2}')
date_today=$(date -d "now" +%s)
date_expire=$(date -d "$expire" +%s)
result=$(( (date_expire - date_today) / 86400 ))-days
echo $result
Running the above will prodice the desired output:
[root@x.x.x.x monitoring]# ./check-easybiny-certificate.sh
75-days
No comments:
Post a Comment