How-To run Postfix second instance
Adding a second Postfix instance
1.Add new IP address to the server.
2.Copy /etc/postfix to /etc/postfix_new_instance cp rp /etc/pstfix /etc/postfix_new_instance
3.Create an additional spool directory /var/spool/postfix_new_instance
4.Edit the new config files (/etc/postfix_new_instance/main.cf):
a) add queue_directory = /var/spool/postfix_new_instance
b) add inet_interfaces = xxx.xxx.xxx.xxx (127.0.0.1 not need)
mynetwork = xxx.xxx.xxx.xxx
c)myhostname = .... , mydomain = ..... , myorigin = $mydomain
d)mydestination = $myhostname, $mydomain
5.Edit the old config file (/etc/postfix/main.cf)
add inet_interfaces = 127.0.0.1 , xxx.xxx.xxx.xxx all needed IP's
(don't forget 127.0.0.1 !!!!)
6.Let Postfix create the appropriate subdirectories and permissions:
postfix c /etc/postfix_new_instance check
cp rp /var/spool/postfix/etc /var/spool/postfix_new_instance
cp rp /var/spool/postfix/usr /var/spool/postfix_new_instance
cp rp /var/spool/postfix/lib /var/spool/postfix_new_instance
7.Create startup script for secondary instance:
cd /etc/init.d/
touch postfix_new_instance
paste in fail
#!/bin/sh
# Start or stop second Postfix Instances
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/postfix
NAME=Postfix
case "$1" in
start)
echo n "Starting mail transport agent: Postfixpriv"
$DAEMON c /etc/postfix_new_instance start 2>&1 |
(grep v 'starting the Postfix' 1>&2 || /bin/true)
echo "."
;;
stop)
echo n "Stopping mail transport agent: Postfixout"
$DAEMON c /etc/postfix_new_instance stop 2>&1 |
(grep v 'stopping the Postfix' 1>&2 || /bin/true)
echo "."
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/postfix_new_instance {start|stop|restart}"
exit 1
;;
esac
exit 0
8.pwd > /etc/init.d Ok. !
9. updaterc.d postfix_new_instance defaults
Adding system startup for /etc/init.d/postfix_priv ...
/etc/rc0.d/K20postfix_new > ../init.d/postfix_new
/etc/rc1.d/K20postfix_new > ../init.d/postfix_new
/etc/rc6.d/K20postfix_new > ../init.d/postfix_new
/etc/rc2.d/S20postfix_new > ../init.d/postfix_new
/etc/rc3.d/S20postfix_new > ../init.d/postfix_new
/etc/rc4.d/S20postfix_new > ../init.d/postfix_new
/etc/rc5.d/S20postfix_new > ../init.d/postfix_new
/etc/init.d/postfix restart
/etc/init.d/postfix_new_instance start