bunch of updates and fixes
[distro-setup] / mail-setup
index 87f644aba3982160248c7ccf0345e19bd455891a..dbdf8fa44cdb307624cdfefadad9133c45720ebf 100755 (executable)
@@ -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'