diff --git a/target/scripts/check-for-changes.sh b/target/scripts/check-for-changes.sh index d28438cb..d86f44dd 100755 --- a/target/scripts/check-for-changes.sh +++ b/target/scripts/check-for-changes.sh @@ -59,6 +59,8 @@ function _check_for_changes # While some config changes may be properly applied by Postfix or Dovecot # via their 'reload' commands; some may require restarting?: _log_with_date 'debug' 'Restarting services due to detected changes' + + [[ ${ENABLE_AMAVIS} -eq 1 ]] && _reload_amavis supervisorctl restart postfix [[ ${SMTP_ONLY} -ne 1 ]] && supervisorctl restart dovecot @@ -86,6 +88,16 @@ function _get_changed_files grep -Fxvf "${CHKSUM_CURRENT}" "${CHKSUM_NEW}" | sed -r 's/^\S+[[:space:]]+//' } +function _reload_amavis +{ + if [[ ${CHANGED} =~ ${DMS_DIR}/postfix-accounts.cf ]] || [[ ${CHANGED} =~ ${DMS_DIR}/postfix-virtual.cf ]] + then + # /etc/postfix/vhost was updated, amavis must refresh it's config by + # reading this file again in case of new domains, otherwise they will be ignored. + amavisd-new reload + fi +} + # Also note that changes are performed in place and are not atomic # We should fix that and write to temporary files, stop, swap and start function _postfix_dovecot_changes