Last active
August 29, 2015 14:16
-
-
Save phenobarbital/2380a0e9e1f1d07e1c42 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple sync mails using Imapsync | |
# Authors: | |
# Jesus Lara <jesuslara@phenobarbital.info> | |
# version: 2.0 | |
# Copyright (C) 2010 Jesus Lara | |
oldserver=10.0.0.10 | |
newserver=10.0.0.11 | |
while read p; do | |
user=( $p ) | |
uid=${p%@*} | |
pass=${user[1]} | |
echo "Migrating mail from user ${uid}" | |
/usr/bin/imapsync --authmech1 LOGIN --host1 $oldserver --authmech2 LOGIN --host2 $newserver --user1 $uid --password1 $pass --user2 $uid --password2 $pass -- | |
syncinternaldates --allowsizemismatch --subscribe_all | |
if [ $? -eq 0 ]; then | |
echo "migration sucessful: ${uid}" | |
else | |
echo "ERROR in ${uid}" | |
echo "${uid} >>error_mbox.log" | |
fi | |
done<migrate_mail.txt | |
echo "Migration Complete." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
"migrate_mail.txt" is a list of users, in a "user pass" format, one line per user.