#!/bin/bash
# 检测https证书有效期
source /etc/profile
while read line; do
echo "====================================================================================="
#echo "now check domain" $line
end_time=$(echo | timeout 1 openssl s_client -servername $line -connect $line:443 2>/dev/null | openssl x509 -noout -enddate 2>/dev/null | awk -F '=' '{
print $2}' )
#([ $? -ne 0 ] || [[ $end_time == '' ]]) && exit 10
end_times=`date -d "$end_time" +%s `
current_times=`date -d "$(date -u '+%b %d %T %Y GMT') " +%s `
let left_time=$end_times-$current_times
days=`expr $left_time / 86400`
echo "$line sheng yu tian shu: " $days
[ $days -lt 30 ] && echo "https shengyu xiaoyu 30 days"
done < ./https_list
网友评论