run check and setup functions only on first container start

This commit is contained in:
casperklein 2024-03-09 23:26:19 +01:00
parent 267fc552d2
commit f8f4faed93
1 changed files with 22 additions and 9 deletions

View File

@ -170,6 +170,9 @@ function _register_functions() {
# ? >> Executing all stacks / actual start of DMS # ? >> Executing all stacks / actual start of DMS
# ------------------------------------------------------------ # ------------------------------------------------------------
# fresh container?
if [[ ! -f /CONTAINER_START ]]; then
# first container start
_early_supervisor_setup _early_supervisor_setup
_early_variables_setup _early_variables_setup
@ -178,13 +181,23 @@ _log 'info' "Welcome to docker-mailserver ${DMS_RELEASE}"
_register_functions _register_functions
_check _check
_setup _setup
[[ ${LOG_LEVEL} =~ (debug|trace) ]] && print-environment
_run_user_patches _run_user_patches
_start_daemons else
# container was restarted
_early_variables_setup
_log 'info' 'Container was restarted. Skipping setup routines..'
_log 'info' "Welcome to docker-mailserver ${DMS_RELEASE}"
_register_functions
fi
# marker to check if container was restarted # marker to check if container was restarted
date >/CONTAINER_START date >/CONTAINER_START
[[ ${LOG_LEVEL} =~ (debug|trace) ]] && print-environment
_start_daemons
_log 'info' "${HOSTNAME} is up and running" _log 'info' "${HOSTNAME} is up and running"
touch /var/log/mail/mail.log touch /var/log/mail/mail.log