From 663c180fc35c9d7f0d44b1cf684ba31a5c0739b1 Mon Sep 17 00:00:00 2001 From: LukeAllen Date: Mon, 5 Jun 2017 21:07:06 -0700 Subject: [PATCH] setting programs to run in foreground --- target/start-mailserver.sh | 23 +++++----- target/supervisor/supervisor-app.conf | 60 +++++++++++++-------------- 2 files changed, 41 insertions(+), 42 deletions(-) diff --git a/target/start-mailserver.sh b/target/start-mailserver.sh index 34a0df7a..4292eab0 100644 --- a/target/start-mailserver.sh +++ b/target/start-mailserver.sh @@ -1123,22 +1123,23 @@ function start_daemons() { } function _start_daemons_cron() { - notify 'task' 'Starting cron' 'n' - supervisorctl start cron + notify 'task' 'Skipping starting cron\n' 'n' + # cron starts automatically. I don't think this is necessary. + #supervisorctl start cron } function _start_daemons_rsyslog() { - notify 'task' 'Starting rsyslog' 'n' + notify 'task' 'Starting rsyslog ' 'n' supervisorctl start rsyslog } function _start_daemons_saslauthd() { notify 'task' 'Starting saslauthd' 'n' - supervisorctl start saslauthd + display_startup_daemon "/etc/init.d/saslauthd start" } function _start_daemons_fail2ban() { - notify 'task' 'Starting fail2ban' 'n' + notify 'task' 'Starting fail2ban ' 'n' touch /var/log/auth.log # Delete fail2ban.sock that probably was left here after container restart if [ -e /var/run/fail2ban/fail2ban.sock ]; then @@ -1148,18 +1149,18 @@ function _start_daemons_fail2ban() { } function _start_daemons_opendkim() { - notify 'task' 'Starting opendkim' 'n' + notify 'task' 'Starting opendkim ' 'n' supervisorctl start opendkim } function _start_daemons_opendmarc() { - notify 'task' 'Starting opendmarc' 'n' + notify 'task' 'Starting opendmarc ' 'n' supervisorctl start opendmarc } function _start_daemons_postfix() { notify 'task' 'Starting postfix' 'n' - supervisorctl start postfix + display_startup_daemon "/etc/init.d/postfix start" } function _start_daemons_dovecot() { @@ -1170,7 +1171,7 @@ function _start_daemons_dovecot() { if [ "$ENABLE_POP3" = 1 ]; then notify 'task' 'Starting pop3 services' 'n' mv /etc/dovecot/protocols.d/pop3d.protocol.disab /etc/dovecot/protocols.d/pop3d.protocol - display_startup_daemon "/usr/sbin/dovecot reload" + /usr/sbin/dovecot reload fi if [ -f /tmp/docker-mailserver/dovecot.cf ]; then @@ -1196,7 +1197,7 @@ function _start_daemons_filebeat() { function _start_daemons_fetchmail() { notify 'task' 'Starting fetchmail' 'n' /usr/local/bin/setup-fetchmail - supervisorctl start fetchmail + display_startup_daemon "/etc/init.d/fetchmail start" } function _start_daemons_clamav() { @@ -1248,7 +1249,7 @@ notify 'taskgrp' "#" notify 'taskgrp' "#" notify 'taskgrp' "" -supervisord +supervisord -c /etc/supervisor/conf.d/supervisor-app.conf register_functions diff --git a/target/supervisor/supervisor-app.conf b/target/supervisor/supervisor-app.conf index cfcacc4d..6a99635f 100644 --- a/target/supervisor/supervisor-app.conf +++ b/target/supervisor/supervisor-app.conf @@ -1,83 +1,81 @@ # each program entry below is a separate terminal command. -# Each command is expected to run in the foreground and stay running. +# Each command MUST run in the foreground and stay running. # If the command ever exits, the supervisor daemon will automatically run it again. # Programs can be controlled like this: 'supervisorctl start fail2ban' 'supervisorctl stop fail2ban' # supervisor writes program statuses in /var/log/supervisor -[program:cron] -startsecs=0 -autostart=false -autorestart=true -command = /usr/sbin/cron - [program:rsyslog] startsecs=0 autostart=false autorestart=true -command = /etc/init.d/rsyslog start +command = /usr/sbin/rsyslogd -n -[program:saslauthd] -startsecs=0 -autostart=false -autorestart=true -command = /etc/init.d/saslauthd start + +# Couldn't figure out how to run this in the foreground. We'll start it without supervisor. +#[program:saslauthd] +#startsecs=0 +#autostart=false +#autorestart=true +#command = /etc/init.d/saslauthd start [program:fail2ban] startsecs=0 autostart=false autorestart=true -command = /etc/init.d/fail2ban start +command = /usr/bin/fail2ban-server -f [program:opendkim] startsecs=0 autostart=false autorestart=true -command = /etc/init.d/opendkim start +command = /usr/sbin/opendkim -f [program:opendmarc] startsecs=0 autostart=false autorestart=true -command = /etc/init.d/opendmarc start +command = /usr/sbin/opendmarc -f -p local:/var/run/opendmarc/opendmarc.sock -[program:postfix] -startsecs=0 -autostart=false -autorestart=true -command = /etc/init.d/postfix start +# Couldn't figure out how to run this in the foreground. We'll start it without supervisor. +#[program:postfix] +#startsecs=0 +#autostart=false +#autorestart=true +#command = /etc/init.d/postfix start [program:dovecot] startsecs=0 autostart=false autorestart=true -command = /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf +command = /usr/sbin/dovecot -F -c /etc/dovecot/dovecot.conf [program:filebeat] startsecs=0 autostart=false autorestart=true -command = /etc/init.d/filebeat start +command = /usr/bin/filebeat -c /etc/filebeat/filebeat.yml -[program:fetchmail] -startsecs=0 -autostart=false -autorestart=true -command = /etc/init.d/fetchmail start +# Couldn't figure out how to run this in the foreground. We'll start it without supervisor. +#[program:fetchmail] +#startsecs=0 +#autostart=false +#autorestart=true +#command = /usr/bin/fetchmail [program:clamav] startsecs=0 autostart=false autorestart=true -command = /etc/init.d/clamav-daemon start +command = /usr/sbin/clamd -c /etc/clamav/clamd.conf [program:postgrey] startsecs=0 autostart=false autorestart=true -command = /etc/init.d/postgrey start +command = /usr/sbin/postgrey --inet=127.0.0.1:10023 [program:amavis] startsecs=0 autostart=false autorestart=true -command = /etc/init.d/amavis start +command = /usr/sbin/amavisd-new foreground