fixes for second bind host
[distro-setup] / mail-setup
index dbdf8fa44cdb307624cdfefadad9133c45720ebf..a8692ef23d53ce75e8c7a53361d0615d1a08c67b 100755 (executable)
@@ -777,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 ||:
@@ -802,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 <<EOF
-\$a root:
+\$a root: root@mail.iankelling.org
 /^root:/d
 EOF
 
@@ -873,8 +875,11 @@ fi
 
 # * reload exim
 
-systemctl reload exim4
-systemctl start exim4
+if systemctl is-active exim4 >/dev/null; then
+  systemctl reload exim4
+else
+  systemctl start exim4
+fi
 
 
 # * mail monitoring / testing