X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=mail-setup;h=3efee8bf7f7c7882ffef931ea2d39d9ecd45b3f5;hb=9d5638298349b859d69c95a88d3e6270fced62f9;hp=87f644aba3982160248c7ccf0345e19bd455891a;hpb=a44ee8f739e11ef40402ea7eab92508f70445e68;p=distro-setup diff --git a/mail-setup b/mail-setup index 87f644a..3efee8b 100755 --- a/mail-setup +++ b/mail-setup @@ -743,7 +743,7 @@ EOF # https://selivan.github.io/2017/12/30/systemd-serice-always-restart.html - d=/etc/systemd/system/openvpn@mail + d=/etc/systemd/system/openvpn@mail.service.d mkdir -p $d cat >$d/override.conf <<'EOF' [Service] @@ -755,7 +755,10 @@ RestartSec=1 # StartLimitIntervalSec in recent systemd versions StartLimitInterval=0 EOF - + if ! systemctl cat openvpn@mail.service|grep -xF StartLimitInterval=0 &>/dev/null; then + # needed for the above config to go into effect + systemctl daemon-reexec + fi systemctl enable mailclean.timer @@ -765,7 +768,7 @@ EOF systemctl enable dovecot systemctl restart dovecot -# * not MAIL_HOST + # * not MAIL_HOST else # $HOSTNAME != $MAIL_HOST # remove mail. 2 lines to properly remove whitespace sed -ri -f - /etc/hosts <<'EOF' @@ -774,7 +777,9 @@ s#^(127\.0\.1\.1 .*)mail\.iankelling\.org +(.*)#\1\2# EOF echo | /a/exe/cedit mail /etc/dnsmasq-servers.conf || [[ $? == 1 ]] - systemctl reload dnsmasq + if systemctl is-active dnsmasq >/dev/null; then + systemctl reload dnsmasq + fi systemctl disable mailclean.timer &>/dev/null ||: systemctl stop mailclean.timer &>/dev/null ||: @@ -799,10 +804,10 @@ EOF hostname -f > /etc/mailname - # We set this to alerts on MAIL_HOST, but using a user that doesn't exist elsewhere + # This ends up at alerts mailbox on MAIL_HOST, but using a user that doesn't exist elsewhere # is no good. sed -i --follow-symlinks -f - /etc/aliases <