File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change 33export PATH=$PATH :/usr/sbin
44
55CERT=/etc/ssl/private/cert.pem
6+ RENEW=2592000 # seconds to cert expiry to try renew: 2592000 = 30 days
67LOG=/var/log/confconsole/letsencrypt.log
8+ LOG_INFO= # set to always log certificate expiry check
79DEHYDRATED=/usr/lib/confconsole/plugins.d/Lets_Encrypt/dehydrated-wrapper
810ARG=" --force"
911
1012log () {
11- echo " [$( date " +%Y-%m-%d %H:%M:%S" ) ] cron: ${1} " >> $LOG
13+ echo -ne " [$( date " +%Y-%m-%d %H:%M:%S" ) ] cron: ${1} " >> $LOG
1214}
1315
14- if $( which openssl) x509 -checkend 2592000 -noout -in $CERT ; then
15- log " $CERT does not require renewal. Nothing to do."
16+ exit_code=0
17+ check_cert_expire=$( $( which openssl) x509 -checkend $RENEW -noout -in $CERT ) \
18+ || exit_code=$?
19+ msg=" ${CERT} : ${check_cert_expire} within $(( $RENEW / 60 / 60 / 24 )) days"
20+
21+ if [ " $exit_code " -eq 0 ]; then
22+ [ -z " $LOG_INFO " ] \
23+ || log " ${msg} . Nothing to do.\n"
1624else
17- log " $CERT has expired or will do so within 30 days . Attempting renewal."
25+ log " ${msg} ( or has already) . Attempting renewal.\n "
1826 $DEHYDRATED $ARG
1927 if [ $? -ne 0 ]; then
20- log " ERROR : $( basename $DEHYDRATED ) exited with a non-zero exit code."
28+ log " ERR : $( basename $DEHYDRATED ) exited with a non-zero exit code.\n "
2129 fi
2230fi
23-
You can’t perform that action at this time.
0 commit comments