CleanIMAPunSync: cleaning zombie IMAP folders on the backup server
Emin Gabrielyan and Oussama Hammami
CleanIMAPunSync: cleaning zombie IMAP folders on the backup server
This script is a complementary to imapsync. It deletes the folders that exist in the destination server but do not exist in the source. The imapsync does not delete folders in the destination server that are not in the source. If you backup by periodically syncing with an imapsync in a crontab, then (without CleanIMAPunsync) you may have serious problems when frequently renaming folders at the source.
On the source server, imapsync would copy each renamed instance to the destination and you may end up with multiple copies of the same folder on the destination server. Imapsync alone will not remove the zombie folders on the destination server. This script solves this problem. You must run this script periodically, before or after the imapsync. It will remove on the destination server all folders which are not available on the source server.
The following example cleans the unsynced folders between a Zimbra (source) and Dovecot (backup) servers:
host1=mail2.switzernet.com user1=support@mail2.switzernet.com pass1=xxxx dir1="INBOX/Support/4 Reception/" host2=backup.switzernet.com user2=admin@backup.switzernet.com pass2=yyyy dir2="support.INBOX.Support.4 Reception." cleanimapunsync
There is only one bash file, to be copied in the /usr/bin folder. It’s assumed that the perl is installed. The output will be logged in /var/log/cleanimapunsync.log
Version Download........................................................................................................................ Script
v100604.2 ver/100604.2-cleanimapunsync.zip
v100604.a26.sh ver/100604.a26.sh,cleanimapunsync.zip.......................................... ver/100604.a26.sh.txt
* * *
Copyright © 2010 by Switzernet