mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-08-29 14:28:55 +02:00
scripts: added TZ
environment variable to set timezone (#2530)
This commit is contained in:
parent
b1594a8b1c
commit
a1726dc45a
5 changed files with 64 additions and 0 deletions
|
@ -107,6 +107,7 @@ VARS[SPOOF_PROTECTION]="${SPOOF_PROTECTION:=0}"
|
|||
VARS[SRS_SENDER_CLASSES]="${SRS_SENDER_CLASSES:=envelope_sender}"
|
||||
VARS[SSL_TYPE]="${SSL_TYPE:=}"
|
||||
VARS[TLS_LEVEL]="${TLS_LEVEL:=modern}"
|
||||
VARS[TZ]="${TZ:=}"
|
||||
VARS[UPDATE_CHECK_INTERVAL]="${UPDATE_CHECK_INTERVAL:=1d}"
|
||||
VARS[VIRUSMAILS_DELETE_DELAY]="${VIRUSMAILS_DELETE_DELAY:=7}"
|
||||
|
||||
|
@ -131,6 +132,8 @@ function register_functions
|
|||
_register_setup_function '_setup_default_vars'
|
||||
_register_setup_function '_setup_file_permissions'
|
||||
|
||||
[[ -n ${TZ} ]] && _register_setup_function '_setup_timezone'
|
||||
|
||||
if [[ ${SMTP_ONLY} -ne 1 ]]
|
||||
then
|
||||
_register_setup_function '_setup_dovecot'
|
||||
|
|
|
@ -1263,3 +1263,25 @@ EOF
|
|||
supervisorctl reread
|
||||
supervisorctl update
|
||||
}
|
||||
|
||||
function _setup_timezone
|
||||
{
|
||||
_log 'debug' "Setting timezone to '${TZ}'"
|
||||
|
||||
local ZONEINFO_FILE="/usr/share/zoneinfo/${TZ}"
|
||||
|
||||
if [[ ! -e ${ZONEINFO_FILE} ]]
|
||||
then
|
||||
_log 'warn' "Cannot find timezone '${TZ}'"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ln -fs "${ZONEINFO_FILE}" /etc/localtime \
|
||||
&& dpkg-reconfigure -f noninteractive tzdata &>/dev/null
|
||||
then
|
||||
_log 'trace' "Set time zone to '${TZ}'"
|
||||
else
|
||||
_log 'warn' "Setting timezone to '${TZ}' failed"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue