Here is how I did it - hopefully someone else would find it useful.
It is based on the idea from this post.
I am asuming that you have the secondary server installed and Sendmail set up so that it listens on apropriate IP address(es).
By default - Sendmail listens only on 127.0.0.1 (at least on CentOS).
MASTER SERVER (Direct Admin):
Type this as root:
SLAVE SERVER(I have CentOS 3.9 with Sendmail ClamAV and ClamAV milter, but it is up to you...)
1. Edit the file "/etc/mail/updatedomains.sh" and put this code in there:
xx.xx.xx.xx = the IP address or hostname of your primary (Direct Admin) server.
2. Now, the only thing left to do is to type this as root:
This will cause the domain list to be refreshed every 5 minutes.
- For this to work, you will have to designate the secondary server as the MX host for every domain that it will be relaying.
- You can have more than one slave server
You can, of course, find a way to enable only the secondary server to read the "domains" file on the master as a security measure, but I leave that up to you.
I hope this will help someone.
Dejan
P.S. I'm not too good in scripting so I apologize if this looks clumsy to anyone
It is based on the idea from this post.
I am asuming that you have the secondary server installed and Sendmail set up so that it listens on apropriate IP address(es).
By default - Sendmail listens only on 127.0.0.1 (at least on CentOS).
MASTER SERVER (Direct Admin):
Type this as root:
Code:
mkdir -p /var/www/html/secmail
ln -s /etc/virtual/domains /var/www/html/secmail/domains
SLAVE SERVER(I have CentOS 3.9 with Sendmail ClamAV and ClamAV milter, but it is up to you...)
1. Edit the file "/etc/mail/updatedomains.sh" and put this code in there:
Code:
#!/bin/sh
#
# This script updates domain list from primary to the secondary E-mail server
#
cat /dev/null > /var/mail/relay-domains
/usr/bin/wget http://xx.xx.xx.xx/secmail/domains -O /etc/mail/relay-domains
/etc/init.d/sendmail reload
xx.xx.xx.xx = the IP address or hostname of your primary (Direct Admin) server.
2. Now, the only thing left to do is to type this as root:
Code:
touch /var/spool/cron/root && echo "*/5 * * * * /etc/mail/updatedomains.sh >/dev/null 2>&1" >> /var/spool/cron/root && service crond restart
This will cause the domain list to be refreshed every 5 minutes.
- For this to work, you will have to designate the secondary server as the MX host for every domain that it will be relaying.
- You can have more than one slave server
You can, of course, find a way to enable only the secondary server to read the "domains" file on the master as a security measure, but I leave that up to you.
I hope this will help someone.
Dejan
P.S. I'm not too good in scripting so I apologize if this looks clumsy to anyone
Last edited: