Re: [Dovecot] mbox to maildir batch conversion

2009-01-29 Thread Dirk Essl

On 29.01.2009 18:29 Uhr, Mike Hobbs wrote:

Hello,


Hi Mike,


I'm upgrading my mail server from UW to Dovecot and I'd like to convert
from mbox to maildir. I've successfully convert myself and a few other
users with the mb2md script. All is well.

My question is, I have somewhere around 500 users and about 122gb of
mail folders to convert (this does not include the inbox at /var/mail).

mb2md needs to be run as each user to convert. Are there any programs or
scripts out there that will allow me to convert everyone at the same time?


I have created such a script which does a few checks before as well.
We didn't do a 'real' batch conversion, because nothing was in a defined 
state at the time of the conversion. We did do it in batches of 10 users 
per hour and everyone got an email before, telling them in which 
timeframe the migration of their account will take place.
A big help for the migration was perdition (imap proxy) so no 
reconfiguration of the client was needed.



I know there is a Dovecot plugin to convert mail, but we didn't want to
use this option.

I'm sure someone on this list was in the same situation as me, how did
you handle a massive conversion?


The attached script does a lot of other things as well, maybe just 
reading it will give you an idea of what to expect.




Any help or suggestions is much appreciated!



cheers,
dirk
#!/bin/bash
# m2f - mail to fiction Dirk Essl 

PROGNAME=`basename $0`
VERSION=0.5
MUSER=$1

# don't convert the root mailbox and exit if $1 is empty

if [ $1 = root ]; then
echo "you try to convert root (stupid)"
exit 1
fi

# MFROM : Server from which will be migrated from
MFROM=mercury

# MFROMDIR : Directory holding the actual INBOX file (with trailing slash)
MFROMDIR=/net/mercury/var/mail/

# MFROMH : Directory holding the actual mbox format mailboxes
MFROMH=/home/$MUSER/MailImap

# MTO : Server beeing migrated to
MTO=fiction

# MTODIR : Directory holding the new maildirectory (with trailing slash)
MTODIR=/var/maildir/

# POPMAPS : Server holding the NIS map for the perdition Imap Proxy
#POPMAPS=poisson
POPMAPS=tweezers

# POPMAP : filename of the NIS map.
POPMAP=/etc/yp/mailserver


# Don't change anything below here

# create lockfile while compiling the nis map and locking the users mailbox
if [ -f /root/m2f.lock ]; then
echo -e "\033[1;33m##"
echo -e "\033[7;5;1;33m# # # # # # #  E R R O R  # # # # # # # # 
#\\033[0m"
echo -e "\033[1;33man instance of m2f is running"
echo -e "\033[1;33mplease wait until the NIS map is compiled"
echo -e "\033[1;33mif you yhink this is an error, remove the file 
m2f.lock"
echo -e "\033[1;33m##"
exit 1
fi

id $MUSER
errlv=$?
if [ $errlv != "0" ]; then
echo -e "\033[7;5;1;33muser $MUSER is not in ESO domain\\033[0m"
exit 1
fi

# check if user is currently hosted in kila or sc6
KILA=`ssh r...@mercury grep $MUSER /etc/mail/mailusers.kila`

if [ "X$KILA" != "X" ]; then
echo "$MUSER is active in kila!"
exit 1
fi

SC6=`ssh r...@mercury grep $MUSER /etc/mail/mailusers.sc6`

if [ "X$KILA" != "X" ]; then
echo "$MUSER is active in sc6!"
exit 1
fi

# check if user has sbd files by grep .mailboxlist

NO_SBD=`su - $MUSER -c 'cat ~/.mailboxlist' | egrep '\.sbd$|\.sbd/'|  wc -l`
echo -e $NO_SBD "sbd-files inside .mailboxlist"


if [ $NO_SBD != "0" ]; then
echo -e "\033[1;33m##"
echo -e "\033[7;5;1;33m# # # # # # #  E R R O R  # # # # # # # # 
#\\033[0m"
echo -e "\033[1;33mUser's .mailboxlist mentiones *.sbd-files"
echo -e "\033[1;33mplease postpone converting this user"

echo -e "\033[1;33m##"
exit 1
fi

# check if user has sbd files by find

NO_SBD=`su - $MUSER -c 'find ~/MailImap/ -name "*.sbd"' | egrep 'sbd$'|  wc -l`
echo -e $NO_SBD "sbd-files inside MailImap"


if [ $NO_SBD != "0" ]; then
echo -e "\033[1;33m##"
echo -e "\033[7;5;1;33m# # # # # # #  E R R O R  # # # # # # # # 
#\\033[0m"
echo -e "\033[1;33mUser has one or more *.sbd-files inside 
MailImap-Folder"
echo -e "\033[1;33mplease postpone converting this user"

echo -e "\033[1;33m##"
exit 1
fi

# check if use

Re: [Dovecot] Smooth mailbox to maildir migration

2009-02-14 Thread Dirk Essl

On 10.02.2009 16:49 Uhr, Luciano Mannucci wrote:

Hi all,


Hi,


I have a postfix+procmail+dovecot installation, now running basicaly
on pop3 hence mailbox format, with few thousand users and less than
twenty gigabytes mail.
I need to move all of them to maildir, to take advantage of IMAP
subfolders that do not work with mbox format (so I'm told :).
Of course I cannot safely stop the service for more than a bunch of
seconds...

What I'm about to do:

create a second dovecot instance to cope with imap client configured
for maildir (and possibly pop3 on another port for those using both),
which means a dovecot launched with -c /path/to/alternate.conf and a
new /etc/init.d/dovecot2-theRevenge having the proper -i option given
to startproc in order to make it ignore the other instance.

for each user:

convert the mailbox with some sort of mb2mb (which is the better one?)

create a .procmailrc with a proper DEFAULT= bearing the magic trailing
slash indicating maildir to procmail for each converted user.

And I'm done...

Have I forgotten something?
Is there a better way?


I do all migrations with perdition (imap proxy) It is very simpe to 
configure and rock solid. So you can make perdition listen on 110, 
dovecotA listens on 111 and dovecotB listens on 112. A text file tells 
who is on which server. With this setup you can even migrate into the 
same directory from mbox to maildir.



Any one else tryed such a thing?

Cheers to all,

luciano.


cheers,
dirk


Re: [Dovecot] Init.d boot scripts??

2007-04-02 Thread Dirk Essl

[EMAIL PROTECTED] wrote:

Hello,

Trying to figure out how to get dovecot to startup at boot. I saw the
Ubuntu script on the dovecot site, but that didn't work on my system (SuSe
10.2). Of course, copying the /usr/local/sbin/dovecot file into
/etc/init.d doesn't work at all.  Any one have working SuSe script??


I don't have a SuSE script, but I use something like this on Solaris
just adjust CFG and BIN to fit your needs

begin

#!/bin/sh
#
# Dovecot Secure IMAP/pop server

## please configure to fit your needs here
CFG=/etc/dovecot.conf
BIN=/usr/local/sbin/dovecot
PROC=dovecot
## configuration ends
if [ ! -f $CFG ]; then
exit 0;
fi

case $1 in

'start')
$BIN -c $CFG
;;
'stop')
pkill -KILL $PROC
;;
'restart')
pkill -KILL $PROC
sleep 2
$BIN -c $CFG
;;
*)  echo "Usage: $0 {start|stop|restart}"
;;
esac

end



Rodman


dirk