Blame cyrus-imapd-README.HOWTO-recover-mailboxes.db
|
John Dennis |
66ca73 |
With this rpm, you should usually find backups of your mailboxes.db
|
|
John Dennis |
66ca73 |
in /var/lib/imap/backup/. If you don't have them, for any reason,
|
|
John Dennis |
66ca73 |
you can recreate it like this.
|
|
John Dennis |
66ca73 |
|
|
John Dennis |
66ca73 |
Note: The scripts doesn't care with different hashing schemes of
|
|
John Dennis |
66ca73 |
the mailspool. Adjust as needed!
|
|
John Dennis |
66ca73 |
And please, check the permissions mailboxes.db after creating it.
|
|
John Dennis |
66ca73 |
|
|
John Dennis |
66ca73 |
#!/bin/sh
|
|
John Dennis |
66ca73 |
#
|
|
John Dennis |
66ca73 |
|
|
John Dennis |
66ca73 |
# stop cyrus-imapd
|
|
John Dennis |
66ca73 |
service cyrus-imapd stop
|
|
John Dennis |
66ca73 |
|
|
John Dennis |
66ca73 |
# backup existing mailboxes.db
|
|
John Dennis |
66ca73 |
mv /var/lib/imap/mailboxes.db /var/lib/imap/mailboxes.db.$$
|
|
John Dennis |
66ca73 |
find /var/spool/imap/?/user -maxdepth 1 -mindepth 1 | \
|
|
John Dennis |
66ca73 |
while read i; do
|
|
John Dennis |
66ca73 |
echo $(basename $i)
|
|
John Dennis |
66ca73 |
echo "user.$i<\t>default<\t>$i<\t>lrswipcda<\t>cyrus<\t>lrswipcda" >> /tmp/newmboxlist.txt
|
|
John Dennis |
66ca73 |
done
|
|
John Dennis |
66ca73 |
|
|
John Dennis |
66ca73 |
# we have everyone's base directory in /tmp/newmboxlist.txt, now we
|
|
John Dennis |
66ca73 |
# import the new list
|
|
John Dennis |
66ca73 |
/usr/lib/cyrus-imapd/ctl_mboxlist -u
|
|
John Dennis |
66ca73 |
|
|
John Dennis |
66ca73 |
# and reconstruct to get subfolders into the list
|
|
John Dennis |
66ca73 |
find /var/spool/imap/?/user -maxdepth 1 -mindepth 1 | \
|
|
John Dennis |
66ca73 |
while read i; do
|
|
John Dennis |
66ca73 |
/usr/lib/cyrus-imapd/reconstruct -rf user.$i
|
|
John Dennis |
66ca73 |
done
|