diff --git a/roles/deploy-web/files/check_ssl.sh b/roles/deploy-web/files/check_ssl.sh new file mode 100644 index 0000000..877ecf8 --- /dev/null +++ b/roles/deploy-web/files/check_ssl.sh @@ -0,0 +1,10 @@ +#!/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