11 lines
353 B
Bash

#!/bin/bash
expire=$(echo | openssl s_client -connect clarissariviere.com:443 2>/dev/null | openssl x509 -noout -enddate |awk -F "=" '{print $2}')
timeExpire=$(date --date="${expire}" +%s)
now=$(date +%s)
if [ ${now} -gt ${timeExpire} ]; then
certbot renew
echo "Certificat renouvellé" | mail -s "certificat renouvelle" valczebackup@gmail.com
fi