mirror of
https://github.com/docker-mailserver/docker-mailserver.git
synced 2025-07-24 04:34:50 +02:00
scripts: new log (#2493)
* added new `_log` function With `_log`, the `_notify` method wa rendered obsolete. `_notify` was not completely removed due to test failures in `check-for-changes.sh`. The new `_log` function properly uses log levels such as `trace`, `debug`, `info`, `warn` and `error`. It provides a cleaner solution and renders `DMS_DEBUG` obsolete too (as only `_notify` depends on it). * converted all helper script to new `_log` function * converted all startup stacks to new `log` function * `start-mailserver.sh` now uses new `_log` function * final test and misc small script adjustments * updated documentation
This commit is contained in:
parent
d8d4b6a189
commit
24031ae365
19 changed files with 367 additions and 221 deletions
|
@ -2,28 +2,28 @@
|
|||
|
||||
function fix
|
||||
{
|
||||
_notify 'tasklog' 'Post-configuration checks'
|
||||
_log 'info' 'Post-configuration checks'
|
||||
for FUNC in "${FUNCS_FIX[@]}"
|
||||
do
|
||||
${FUNC}
|
||||
done
|
||||
|
||||
_notify 'inf' 'Removing leftover PID files from a stop/start'
|
||||
_log 'trace' 'Removing leftover PID files from a stop/start'
|
||||
find /var/run/ -not -name 'supervisord.pid' -name '*.pid' -delete
|
||||
touch /dev/shm/supervisor.sock
|
||||
}
|
||||
|
||||
function _fix_var_mail_permissions
|
||||
{
|
||||
_notify 'task' 'Checking /var/mail permissions'
|
||||
_log 'debug' 'Checking /var/mail permissions'
|
||||
|
||||
# fix permissions, but skip this if 3 levels deep the user id is already set
|
||||
if find /var/mail -maxdepth 3 -a \( \! -user 5000 -o \! -group 5000 \) | read -r
|
||||
then
|
||||
_notify 'inf' 'Fixing /var/mail permissions'
|
||||
_log 'trace' 'Fixing /var/mail permissions'
|
||||
chown -R 5000:5000 /var/mail || _shutdown 'Failed to fix /var/mail permissions'
|
||||
else
|
||||
_notify 'inf' 'Permissions in /var/mail look OK'
|
||||
_log 'trace' 'Permissions in /var/mail look OK'
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -33,24 +33,24 @@ function _fix_var_amavis_permissions
|
|||
[[ ${ONE_DIR} -eq 0 ]] && AMAVIS_STATE_DIR="/var/lib/amavis"
|
||||
[[ ! -e ${AMAVIS_STATE_DIR} ]] && return 0
|
||||
|
||||
_notify 'inf' 'Fixing Amavis permissions'
|
||||
_log 'trace' 'Fixing Amavis permissions'
|
||||
chown -hR amavis:amavis "${AMAVIS_STATE_DIR}" || _shutdown 'Failed to fix Amavis permissions'
|
||||
}
|
||||
|
||||
function _fix_cleanup_clamav
|
||||
{
|
||||
_notify 'task' 'Cleaning up disabled ClamAV'
|
||||
_log 'trace' 'Cleaning up disabled ClamAV'
|
||||
rm /etc/logrotate.d/clamav-* /etc/cron.d/clamav-freshclam 2>/dev/null || {
|
||||
# show error only on first container start
|
||||
[[ ! -f /CONTAINER_START ]] && _notify 'err' 'Failed to remove ClamAV configuration'
|
||||
# show warning only on first container start
|
||||
[[ ! -f /CONTAINER_START ]] && _log 'warn' 'Failed to remove ClamAV configuration'
|
||||
}
|
||||
}
|
||||
|
||||
function _fix_cleanup_spamassassin
|
||||
{
|
||||
_notify 'task' 'Cleaning up disabled SpamAssassin'
|
||||
_log 'trace' 'Cleaning up disabled SpamAssassin'
|
||||
rm /etc/cron.daily/spamassassin 2>/dev/null || {
|
||||
# show error only on first container start
|
||||
[[ ! -f /CONTAINER_START ]] && _notify 'err' 'Failed to remove SpamAssassin configuration'
|
||||
# show warning only on first container start
|
||||
[[ ! -f /CONTAINER_START ]] && _log 'warn' 'Failed to remove SpamAssassin configuration'
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue