add ONE_SHOT so container exits after run

This commit is contained in:
2023-07-17 17:49:02 +00:00
parent 58ede5f1b6
commit c16e730a19
10 changed files with 29 additions and 4 deletions

View File

@ -761,9 +761,19 @@ then
openssl dhparam -out /config/letsencrypt/keys/ssl-dhparams.pem 4096
fi
echo "$INTERVAL /certbot-renew.sh >> /config/logs/renew.log" > /config/.crontab.txt
if [ $ONE_SHOT == "true" ]; then
echo ""
echo ""
echo "Starting automatic renewal job. Schedule is $INTERVAL"
crontab /config/.crontab.txt
echo "ONE_SHOT is true - exiting container"
elif [ $ONE_SHOT == "false" ]; then
echo "$INTERVAL /certbot-renew.sh >> /config/logs/renew.log" > /config/.crontab.txt
echo ""
echo "Starting automatic renewal job. Schedule is $INTERVAL"
crontab /config/.crontab.txt
fi

9
root/check-one-shot.sh Normal file
View File

@ -0,0 +1,9 @@
#!/command/with-contenv bash
# shellcheck shell=bash
if [ $ONE_SHOT == "true" ]; then
# Cleanly kill container by sending kill signal to supervisor process
kill 1
fi

View File

@ -28,6 +28,7 @@ echo \
"PUID=${PUID}
PGID=${PGID}
TZ=${TZ}
ONE_SHOT=${ONE_SHOT}
INTERVAL=${INTERVAL}
GENERATE_DHPARAM=${GENERATE_DHPARAM}
CERT_COUNT=${CERT_COUNT}"

View File

@ -0,0 +1 @@
oneshot

View File

@ -0,0 +1 @@
exec /check-one-shot.sh