Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Apr 2001 08:59:03 +0200 (CEST)
From:      Paul Herman <pherman@frenchfries.net>
To:        Odhiambo Washington <wash@wananchi.com>
Cc:        FBSD-Q <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Moving Mail servers
Message-ID:  <Pine.BSF.4.33.0104220840150.88695-100000@husten.security.at12.de>
In-Reply-To: <20010422051129.A33555@everest.wananchi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Wash,

On Sun, 22 Apr 2001, Odhiambo Washington wrote:

> I am changing servers but I have users mails amounting to 3GB on
> the old server. The mail is in /var/mail/$user. My new server is
> siting next to the old. Is there someone who knows a way to tell
> sendmail to send the mails out again?????

If the users are the same, it's easy.  First, copy the mailboxes over
to the new machine (with tar/ftp, or NFS, etc...) into a temporary
directory, say /tmp/mail.  Then do something like:

 umask 077
 cd /tmp/mail
 for mailbox in *; do
   if [ -e /var/mail/${mailbox}.lock ]
   then echo "Mailbox for ${mailbox} busy, please do by hand"
   else
	touch /var/mail/${mailbox}.lock
	cat ${mailbox} >> /var/mail/${mailbox}
	chown ${mailbox} /var/mail/${mailbox} > /dev/null 2>&1
	rm /var/mail/${mailbox}.lock
   fi
 done

There might be a race condition on very busy servers, but this should
be OK for most.

If for some reason an old user doesn't exist on the new machine, you
can "find /var/mail -type f -user root" and deal with them
accordingly.

If the usernames are different, then this is more difficult.  :-)

-Paul.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.33.0104220840150.88695-100000>