bunkerized-nginx/scripts/certbot-renew.sh
2021-06-14 13:39:27 +02:00

21 lines
454 B
Bash

#!/bin/sh
# load some functions
. /opt/entrypoint/utils.sh
if [ "$(grep "^SWARM_MODE=yes$" /etc/nginx/global.env)" != "" ] && [ -f /usr/sbin/nginx ] ; then
exit 0
fi
if [ "$(has_value AUTO_LETS_ENCRYPT yes)" = "" ] ; then
exit 0
fi
# ask new certificates if needed
certbot renew --deploy-hook /opt/scripts/certbot-renew-hook.sh
if [ "$?" -eq 0 ] ; then
job_log "[CERTBOT] renew operation done"
else
job_log "[CERTBOT] renew operation failed"
fi