Zimbra and modifying main.cf
There are a couple of customizations that can only be done by editting the /opt/zimbra/postfix/conf/main.cf file. The problem is, if you do any upgrades, you loose your changes. After being burned by this, I added this script to my servers
In my case, I needed all inbound email copied to an archive mailbox. So, first I created a file called /root/bin/UpdateMain.cf
#!/bin/bash target=/opt/zimbra/postfix/conf/main.cf f=`grep -i -c "always_bcc=archivex@mydomain.com" $target` if [ $f = 0 ]; then echo "always_bcc=archivex@mydomain.com" >> $target su zimbra -c "~/bin/postfix reload" fi
Make sure you
chmod 777 /root/bin/UpdateMain.cf
Then:
crontab -e
and add the line
10 * * * * /root/bin/UpdateMain.cf
(you can change the interval if you wish)
and now – you never loose your changes to main.cf!