[Dovecot] basic dsync wrapper for migration from another server
Hi,
I cobbled together this somewhat shoddy Bash script to migrate email accounts from our Cyrus server to a new dovecot system. Feel free to use, or laugh at it as you wish :)
#!/bin/bash
## # Migrate email accounts via IMAP from one server to another ##
trap "kill 0" SIGINT
workdir=/root/migrate
# Load list of users into array. The file "migration_map" should contain one user@domain.tld per line. mapfile userList < $workdir/migration_map
# Number of symultanious migrations num=10
index=0
# Loop over the array of user accounts function process_userlist { procs=$(ps aux | grep "dsync" | grep -v "grep" | wc -l) # Perform $num operations at a time for the length of the userList while [[ $procs -lt $num ]] && [[ ${#userList[@]} -gt $index ]]; do procs=$(ps aux | grep "dsync" | grep -v "grep" | wc -l) dsync -o mail_fsync=never mirror -f -R -u ${userList[$index]} imapc:& echo "procs: $procs user: ${userList[$index]} index: $index" let index++ done }
# Until the userList is empty, keep going until [ ${#userList[@]} -eq $index ]; do process_userlist done
exit 0
On Fri, 28 Mar 2014 14:45:05 +0100 Alan McGinlay wrote:
Hi,
I cobbled together this somewhat shoddy Bash script to migrate email accounts from our Cyrus server to a new dovecot system. Feel free to use, or laugh at it as you wish :)
I do want to rate your script but do you know http://www.cyrus2dovecot.sw.fu-berlin.de
Kind regards, Frank
On Fri, 28 Mar 2014 17:41:24 +0100 Frank Elsner wrote:
On Fri, 28 Mar 2014 14:45:05 +0100 Alan McGinlay wrote:
Hi,
I cobbled together this somewhat shoddy Bash script to migrate email accounts from our Cyrus server to a new dovecot system. Feel free to use, or laugh at it as you wish :)
I do want to rate your script but do you know ^ insert "not" here!
--Frank
On 2014-03-28 17:41, Frank Elsner wrote:
On Fri, 28 Mar 2014 14:45:05 +0100 Alan McGinlay wrote: Hi,
I cobbled together this somewhat shoddy Bash script to migrate email accounts from our Cyrus server to a new dovecot system. Feel free to use, or laugh at it as you wish :)
I do want to rate your script but do you know http://www.cyrus2dovecot.sw.fu-berlin.de
Kind regards, Frank
Hi!
Thanks, yeah I tried that one. Had quite a lot of issues with it and have finally got a complete migration working with dsync so i'm happy :)
participants (2)
-
Alan McGinlay
-
Frank Elsner