bunkerized-nginx/scripts/certbot-renew.sh

22 lines
454 B
Bash
Raw Normal View History

2019-08-20 23:25:16 +02:00
#!/bin/sh
2020-12-16 15:47:02 +01:00
# load some functions
2021-03-17 17:55:56 +01:00
. /opt/entrypoint/utils.sh
2021-06-14 13:39:27 +02:00
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
2020-12-06 22:22:58 +01:00
# 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