use a lock file to keep track of updates
This commit is contained in:
parent
b845464b1f
commit
6b72006d65
1 changed files with 7 additions and 5 deletions
12
certbotd.sh
12
certbotd.sh
|
@ -6,14 +6,16 @@ if test -z "${NODES}"; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lock=/tmp/certbot.lck
|
lock=/tmp/certbot.lck
|
||||||
updated=false
|
updated=/tmp/certbot.updated
|
||||||
|
|
||||||
ensure() {
|
ensure() {
|
||||||
test -n "$1" && echo "$1 received, exiting gracefully..."
|
test -n "$1" && echo "$1 received, exiting gracefully..."
|
||||||
|
|
||||||
rm -f "${lock}"
|
rm -f "${lock}"
|
||||||
|
|
||||||
${updated} || exit 0
|
test -f "${updated}" || exit 0
|
||||||
|
|
||||||
|
rm -f "${updated}"
|
||||||
|
|
||||||
# Fix permissions, users in group ssl have read access
|
# Fix permissions, users in group ssl have read access
|
||||||
find /etc/letsencrypt -type d | xargs -r chmod 2750
|
find /etc/letsencrypt -type d | xargs -r chmod 2750
|
||||||
|
@ -41,7 +43,7 @@ case $1 in
|
||||||
# Renew certificates, trust in certbot's algorithms
|
# Renew certificates, trust in certbot's algorithms
|
||||||
renew)
|
renew)
|
||||||
/usr/bin/certbot renew --quiet --agree-tos
|
/usr/bin/certbot renew --quiet --agree-tos
|
||||||
updated=true
|
touch "${updated}"
|
||||||
;;
|
;;
|
||||||
bootstrap)
|
bootstrap)
|
||||||
for site in ${SUTTY} api.${SUTTY}; do
|
for site in ${SUTTY} api.${SUTTY}; do
|
||||||
|
@ -58,7 +60,7 @@ case $1 in
|
||||||
cd /etc/letsencrypt/live
|
cd /etc/letsencrypt/live
|
||||||
ln -s ${SUTTY} default
|
ln -s ${SUTTY} default
|
||||||
|
|
||||||
updated=true
|
touch "${updated}"
|
||||||
done
|
done
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -101,7 +103,7 @@ case $1 in
|
||||||
--agree-tos \
|
--agree-tos \
|
||||||
--webroot-path /var/lib/letsencrypt \
|
--webroot-path /var/lib/letsencrypt \
|
||||||
-d "${domain}"
|
-d "${domain}"
|
||||||
updated=true
|
touch "${updated}"
|
||||||
done
|
done
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue