function _defunc removed (#2199)

* function _defunc removed

* _shutdown is better than just notify in that cases

* PANIC_TYPE 'fail-init' introduced

Co-authored-by: Georg Lauterbach <44545919+georglauterbach@users.noreply.github.com>
This commit is contained in:
Casper 2021-09-23 19:49:07 +02:00 committed by GitHub
parent 6715e0bba9
commit c7e9dd2bad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 44 deletions

View file

@ -5,31 +5,31 @@ function start_daemons
_notify 'tasklog' 'Starting daemons & mail server'
for FUNC in "${DAEMONS_START[@]}"
do
${FUNC} || _defunc
${FUNC}
done
}
function _start_daemons_cron
{
_notify 'task' 'Starting cron'
supervisorctl start cron
supervisorctl start cron || dms_panic__fail_init 'cron'
}
function _start_daemons_rsyslog
{
_notify 'task' 'Starting rsyslog'
supervisorctl start rsyslog
supervisorctl start rsyslog || dms_panic__fail_init 'rsyslog'
}
function _start_daemons_saslauthd
{
_notify 'task' 'Starting saslauthd'
supervisorctl start "saslauthd_${SASLAUTHD_MECHANISMS}"
supervisorctl start "saslauthd_${SASLAUTHD_MECHANISMS}" || dms_panic__fail_init 'saslauthd'
}
function _start_daemons_fail2ban
{
_notify 'task' 'Starting fail2ban'
_notify 'task' 'Starting Fail2ban'
touch /var/log/auth.log
# delete fail2ban.sock that probably was left here after container restart
@ -38,31 +38,31 @@ function _start_daemons_fail2ban
rm /var/run/fail2ban/fail2ban.sock
fi
supervisorctl start fail2ban
supervisorctl start fail2ban || dms_panic__fail_init 'Fail2ban'
}
function _start_daemons_opendkim
{
_notify 'task' 'Starting opendkim'
supervisorctl start opendkim
supervisorctl start opendkim || dms_panic__fail_init 'opendkim'
}
function _start_daemons_opendmarc
{
_notify 'task' 'Starting opendmarc'
supervisorctl start opendmarc
supervisorctl start opendmarc || dms_panic__fail_init 'opendmarc'
}
function _start_daemons_postsrsd
{
_notify 'task' 'Starting postsrsd'
supervisorctl start postsrsd
supervisorctl start postsrsd || dms_panic__fail_init 'postsrsd'
}
function _start_daemons_postfix
{
_notify 'task' 'Starting postfix'
supervisorctl start postfix
supervisorctl start postfix || dms_panic__fail_init 'postfix'
}
function _start_daemons_dovecot
@ -81,7 +81,7 @@ function _start_daemons_dovecot
cp /tmp/docker-mailserver/dovecot.cf /etc/dovecot/local.conf
fi
supervisorctl start dovecot
supervisorctl start dovecot || dms_panic__fail_init 'dovecot'
}
function _start_daemons_fetchmail
@ -120,41 +120,41 @@ EOF
do
COUNTER=$(( COUNTER + 1 ))
_notify 'task' "Starting fetchmail instance ${COUNTER}"
supervisorctl start "fetchmail-${COUNTER}"
supervisorctl start "fetchmail-${COUNTER}" || _panic__fail_init "fetchmail-${COUNTER}"
done
else
_notify 'task' 'Starting fetchmail'
supervisorctl start fetchmail
supervisorctl start fetchmail || dms_panic__fail_init 'fetchmail'
fi
}
function _start_daemons_clamav
{
_notify 'task' 'Starting clamav'
supervisorctl start clamav
supervisorctl start clamav || dms_panic__fail_init 'ClamAV'
}
function _start_daemons_postgrey
{
_notify 'task' 'Starting postgrey'
rm -f /var/run/postgrey/postgrey.pid
supervisorctl start postgrey
supervisorctl start postgrey || dms_panic__fail_init 'postgrey'
}
function _start_daemons_amavis
{
_notify 'task' 'Starting amavis'
supervisorctl start amavis
supervisorctl start amavis || dms_panic__fail_init 'amavis'
}
function _start_changedetector
{
_notify 'task' 'Starting changedetector'
supervisorctl start changedetector
supervisorctl start changedetector || dms_panic__fail_init 'changedetector'
}
function _start_daemons_update_check
{
_notify 'task' 'Starting update-check'
supervisorctl start update-check
supervisorctl start update-check || dms_panic__fail_init 'update-check'
}