From 66585d9765ff01f851f1c98cac031b3b2caeafcd Mon Sep 17 00:00:00 2001 From: Bruno Zell Date: Wed, 3 Oct 2018 05:09:42 +0200 Subject: [PATCH] put conditional renewal logic into certbot loop --- src/scripts/run_certbot.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/scripts/run_certbot.sh b/src/scripts/run_certbot.sh index 3a68623..7be3067 100644 --- a/src/scripts/run_certbot.sh +++ b/src/scripts/run_certbot.sh @@ -13,9 +13,15 @@ exit_code=0 set -x # Loop over every domain we can find for domain in $(parse_domains); do - if ! get_certificate $domain $CERTBOT_EMAIL; then - error "Cerbot failed for $domain. Check the logs for details." - exit_code=1 + if is_renewal_required $domain; then + if get_certificate $domain $CERTBOT_EMAIL; then + update_renewal_timestamp $domain + else + error "Cerbot failed for $domain. Check the logs for details." + exit_code=1 + fi + else + echo "Not run certbot for $domain; last renewal happened just recently." fi done