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,21 +170,34 @@ function _register_functions() {
# ? >> Executing all stacks / actual start of DMS
# ------------------------------------------------------------
_early_supervisor_setup
_early_variables_setup
# fresh container?
if [[ ! -f /CONTAINER_START ]]; then
# first container start
_early_supervisor_setup
_early_variables_setup
_log 'info' "Welcome to docker-mailserver ${DMS_RELEASE}"
_log 'info' "Welcome to docker-mailserver ${DMS_RELEASE}"
_register_functions
_check
_setup
[[ ${LOG_LEVEL} =~ (debug|trace) ]] && print-environment
_run_user_patches
_start_daemons
_register_functions
_check
_setup
_run_user_patches
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
date >/CONTAINER_START
[[ ${LOG_LEVEL} =~ (debug|trace) ]] && print-environment
_start_daemons
_log 'info' "${HOSTNAME} is up and running"
touch /var/log/mail/mail.log