From 6b72006d65eb09f9e8f25b1454e48f32f871a512 Mon Sep 17 00:00:00 2001 From: f Date: Sat, 10 Sep 2022 16:27:59 -0300 Subject: [PATCH] use a lock file to keep track of updates --- certbotd.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/certbotd.sh b/certbotd.sh index 27eccfb..04b5529 100755 --- a/certbotd.sh +++ b/certbotd.sh @@ -6,14 +6,16 @@ if test -z "${NODES}"; then fi lock=/tmp/certbot.lck -updated=false +updated=/tmp/certbot.updated ensure() { test -n "$1" && echo "$1 received, exiting gracefully..." rm -f "${lock}" - ${updated} || exit 0 + test -f "${updated}" || exit 0 + + rm -f "${updated}" # Fix permissions, users in group ssl have read access find /etc/letsencrypt -type d | xargs -r chmod 2750 @@ -41,7 +43,7 @@ case $1 in # Renew certificates, trust in certbot's algorithms renew) /usr/bin/certbot renew --quiet --agree-tos - updated=true + touch "${updated}" ;; bootstrap) for site in ${SUTTY} api.${SUTTY}; do @@ -58,7 +60,7 @@ case $1 in cd /etc/letsencrypt/live ln -s ${SUTTY} default - updated=true + touch "${updated}" done ;; @@ -101,7 +103,7 @@ case $1 in --agree-tos \ --webroot-path /var/lib/letsencrypt \ -d "${domain}" - updated=true + touch "${updated}" done esac