neb/servers/skel/docker-compose.d/custom/nginx/entrypoint.sh

28 lines
579 B
Bash
Raw Permalink Normal View History

2023-10-20 02:09:03 +02:00
#!/bin/sh
trap exit TERM
if [ -n "${CERTBOT_DOMAINS}" ]; then
2023-10-20 03:38:28 +02:00
echo "registering..."
2023-10-20 04:43:18 +02:00
if ! certbot show_account; then
certbot register -n \
--agree-tos \
-m "${CERTBOT_EMAIL}"
fi
for d in $(echo "${CERTBOT_DOMAINS}" | sed 's/,/ /g'); do
echo "requesting for $d..."
certbot --nginx -n --keep -d "$d"
done
2023-10-20 02:09:03 +02:00
while :; do
echo "renewing domains..."
2023-10-20 03:38:28 +02:00
certbot --nginx --keep -n renew
sleep 12h &
wait $!
2023-10-20 02:09:03 +02:00
done &
else
echo "skipping certbot due to no domains!"
2023-10-20 02:43:56 +02:00
fi &
2023-10-20 02:09:03 +02:00
2023-10-20 04:43:18 +02:00
exec "$@"