From 0d85c88d181a314b22ec1d0489bdfb3269e53fd6 Mon Sep 17 00:00:00 2001 From: dpeca Date: Thu, 27 Dec 2018 21:10:17 +0100 Subject: [PATCH] Bringing back Better handling of calm-down routine while LE renewing Accidentally overwritten in https://github.com/serghey-rodin/vesta/commit/f8b4d42b740752e17944370440f37d3105f4b21f commit Original commit: https://github.com/serghey-rodin/vesta/commit/3d8b6a87a77ae8c026e90eb45212349585adc5e3 Calming down is because https://github.com/serghey-rodin/vesta/issues/1193 issue --- bin/v-update-letsencrypt-ssl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bin/v-update-letsencrypt-ssl b/bin/v-update-letsencrypt-ssl index a5cbc286f..4dd1fcc08 100755 --- a/bin/v-update-letsencrypt-ssl +++ b/bin/v-update-letsencrypt-ssl @@ -22,10 +22,11 @@ source $VESTA/conf/vesta.conf # Action # #----------------------------------------------------------# +lecounter=0 + # Checking user certificates for user in $($BIN/v-list-users plain |cut -f 1); do USER_DATA=$VESTA/data/users/$user - lecounter=0 for domain in $(search_objects 'web' 'LETSENCRYPT' 'yes' 'DOMAIN'); do crt_data=$(openssl x509 -text -in $USER_DATA/ssl/$domain.crt) @@ -35,6 +36,10 @@ for user in $($BIN/v-list-users plain |cut -f 1); do seconds_valid=$((expiration - now)) days_valid=$((seconds_valid / 86400)) if [[ "$days_valid" -lt 31 ]]; then + if [ $lecounter -gt 0 ]; then + sleep 10 + fi + ((lecounter++)) aliases=$(echo "$crt_data" |grep DNS:) aliases=$(echo "$aliases" |sed -e "s/DNS://g" -e "s/,//") aliases=$(echo "$aliases" |tr ' ' '\n' |sed "/^$/d") @@ -44,10 +49,6 @@ for user in $($BIN/v-list-users plain |cut -f 1); do if [ $? -ne 0 ]; then echo "$domain $msg" fi - if [ $lecounter -gt 0 ]; then - sleep 10 - fi - ((lecounter++)) fi done done