1
0
mirror of https://github.com/tomav/docker-mailserver.git synced 2024-06-26 19:25:53 +02:00

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

View File

@ -170,21 +170,34 @@ function _register_functions() {
# ? >> Executing all stacks / actual start of DMS # ? >> Executing all stacks / actual start of DMS
# ------------------------------------------------------------ # ------------------------------------------------------------
_early_supervisor_setup # fresh container?
_early_variables_setup 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 _register_functions
_check _check
_setup _setup
[[ ${LOG_LEVEL} =~ (debug|trace) ]] && print-environment _run_user_patches
_run_user_patches else
_start_daemons # 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