diff --git a/check_sslcerts/checksslcerts.sh b/check_sslcerts/checksslcerts.sh index 8211e20..f5e478f 100644 --- a/check_sslcerts/checksslcerts.sh +++ b/check_sslcerts/checksslcerts.sh @@ -3,8 +3,7 @@ ## crontab ## 0 4 * * * bash /data/scripts/sslcerts/create_sites.sh > /data/scripts/sslcerts/sites.txt ## 0 5 * * * bash /data/scripts/sslcerts/checksslcerts.sh 2>&1 > /tmp/checksslcert.log - -#!/bin/bash + sites=$(cat ./sites.txt) @@ -14,23 +13,14 @@ for site in `echo $sites` do export SITE_URL=$site - #echo $SITE_URL - #echo -n " - " - - notAfter=$(/usr/bin/openssl s_client -connect ${SITE_URL}:${SITE_SSL_PORT} \ -servername ${SITE_URL} 2> /dev/null | /usr/bin/openssl x509 -noout -dates | grep notAfter) - not_after=$(echo "$notAfter" | cut -d= -f2-) - #echo " $not_after" - + not_after=$(echo "$notAfter" | cut -d= -f2-) now_ts=$(date +%s) - #echo " $now_ts" - expiry_ts=$(date -d "$not_after" +%s) diff_sec=$((expiry_ts - now_ts)) diff_days=$((diff_sec / 86400)) - #echo " $diff_days" if [ "$not_after" != "" ] then