Koozali.org: home of the SME Server

How do I just backup the just email?

Jeff Fox

How do I just backup the just email?
« on: December 23, 2003, 05:54:57 PM »
I have an SME box running on my own domain that serves email for 3 users.
I want to just backup the email (no ibays) and then restore it on a new machine.
The old server is running 5.0
The new one is running 6.0

I can create the users on the new machine before I restore the email if necessary.

byte

Re: How do I just backup the just email?
« Reply #1 on: December 23, 2003, 07:13:20 PM »
Follow this....

At your own risk  

1) From your closest mirror, download Charlie Brady's mailfront-0.86-1es2.i386.rpm contrib rpm. Example:

http://www.ibiblio.org/pub/linux/distributions/e-smith/contrib/CharlieBrady/RPMS/i386/mailfront-0.86-1es2.i386.rpm

2) Use the server-manager to add a user named 'maillog'

3) Add the rpm:
# rpm -Uvh mailfront-0.86-1es2.i386.rpm

4) Add the environment variable:
# echo maillog > /var/service/smtpfront-qmail/env/LOG_RECIPIENT

All mail incoming and outgoing is backed up in the maillog directory.

If this is not what you want anymore you can remove by

# rm /var/service/smtpfront-qmail/env/LOG_RECIPIENT
# service smtpfront-qmail restart

Credit to Charlie Brady

HTH

Byte

guestHH

Re: How do I just backup the just email?
« Reply #2 on: December 23, 2003, 08:15:53 PM »
maybe there is somebode around that can explain how to create a custom template for the bakcup script, so that it only backups the user account and their home dir..?

guestHH

byte

Re: How do I just backup the just email?
« Reply #3 on: December 23, 2003, 08:31:30 PM »
I wrote a script so that it checks all emails within the maillog directory and sorts in into inbox and sent items which are then stored in the maillog folders under there user name.

Example of how I done it...

Create a file named what ever you want, then enter info below...

#!/bin/bash

#Directory Of where all emails are stored
DIR="/home/e-smith/files/users/maillog/Maildir/new/*"

#Getting From to sort into Sent Items
grep -l "^From: root" $DIR | xargs -i mv {} /home/e-smith/files/users/maillog/home/root/sent/

#Getting To Field to sort into Inbox
grep -l "^To: root" $DIR | xargs -i mv {} /home/e-smith/files/users/maillog/home/root/inbox/

I will hope to write a HOW-TO when I get back to work and will post to contribs.

If anyone has any improvements to the script please post

Cheers

Byte

Kelvin

Re: How do I just backup the just email?
« Reply #4 on: December 24, 2003, 05:35:31 AM »
Hi Jeff,

I have not tried this so proceed at own risk !

If you only have 3 (or basically very few) users to worry about, how about :-

0) check out and note down the ownership / permissions of the user home folders ( /home/e-smith/files/users/)
1) copy out each users home folders (either directly to the new server or first to an ibay, then to a Windows PC)
2) when the new server is up, recreate all the users
3) copy back the home folders you backed up (including all hidden folders)
4) check and redo the appropriate owner / permissions for the files / folders you copied back.

I think everything to do with a user's mail lives under their home folders so, copying the entire folder out then back and restoring the permissions / ownership *should* work.

Good Luck !

Kelvin

Jesper Knudsen

Re: How do I just backup the just email?
« Reply #5 on: December 26, 2003, 03:20:48 PM »
I am afraid that this is not that simple. The mail folder layout has changed between all major versions :-(

I have done it this way myself BUT what a job - I had to manually copy everything to the right IMAP folders by hand.

IF you do not use folders (or not only webmail) then this can be done very easily.

Kelvin

Re: How do I just backup the just email?
« Reply #6 on: December 26, 2003, 10:09:37 PM »
Hi Jesper,

As Jeff's new server is on a new PC, perhaps he could perform an inplace upgrade of the old server to Version 6 first, then copy the home directories across.

This should put the mail folders into the right places.

Kelvin