Migrating e-smith (SME) mail servers to Qmail/vpopmail/Dovecot

Recently I’ve had to migrate some mail servers from old aging SMI E-Smith boxes to newer CentOS boxes running a mixture of Qmail + Vpopmail + Dovecot.  Now this write up is not going to cover the inital qmail/vpopmail/dovecot setup so, if that’s what you’re looking for… Sorry you haven’t found it.

The primary problem is that the older E-Smith boxes store mail in the following manner:

/home/e-smith/files/user/USERNAME/Maildir

*AND*

/home/e-smith/files/user/USERNAME/Mail

All your folders and such are kept in the ‘Mail’ folder while all your new mail / inbox is kept in the ‘Maildir’ folder.  Why they did this… I don’t know.

Anyways, here are the scripts:

maildir_to_dovecot.sh – This script rsyncs the old data over and then renames it to .Folder.subfolder.etc.


#!/bin/sh
##########################################################
#
# Acquire inputs
#
##########################################################

mailbox=$1
oldhost=”$2″
domain=”$3″

##########################################################
#
# If we don’t have all arguments bail out(tm)
#
##########################################################

if [ -z “$1” ]; then
echo “Usage: $0 user mail.host.tld host.tld”
exit
fi

##########################################################
#
# Rsync the old data, add bwlimit = 150 for pulling from a T1
# This leaves some headroom for them.
#
##########################################################

rsync -av rsync://$oldhost/home/e-smith/files/users/$mailbox /home/vpopmail/domains/$domain/$mailbox

##########################################################
#
# Change to the rsync’d directory and remove all symlinks
#
##########################################################

cd /home/vpopmail/domains/$domain/$mailbox
cd $mailbox
ls -aFd \.* | grep \/ | awk -F\/ ‘{print “rm -rf \””$1″\””}’ | sh

TMP=/tmp/$$.tmp
#
# Look for directories this deep or shallower:
c=20
#
# Recursively start there and go up:
while [ $c -gt 0 ]; do
#
# Find all directories at level $c that aren’t /cur, /new, or /tmp, or /.something
#
find . -nowarn -type d -not -name cur -not -name new -not -name tmp -mindepth $c -not -name ‘.*’ > $TMP
#
# Process each line…
#
while read i; do
#
# Convert every starting dot to nothing
# Convert every “/” to a “.”
j=`echo $i | sed -e ‘s/ /\\ /’ | sed -e ‘s:^\./::’ | sed -e ‘s:/:.:g’`
# Move old to new
mv -v “$i” “.$j”
done < $TMP
#
# Up one level and repeat until level 0
#
c=`expr $c – 1`
done
rm -f $TMP

##########################################################
#
# Change jump out of the rsync’d directory and move everything
# to the new Maildir
#
##########################################################

cd ..
ls -AF $mailbox | grep \/ | awk -F\/ ‘{print “mv \”‘$mailbox’/”$1″\” Maildir/”}’ | sh

##########################################################
#
# Create subscriptions in the new maildir for IMAP
#
##########################################################

cd Maildir
ls -AFd .* | grep \/ | sed -e “s/\(.\)\(.*\)\//\2/g” > subscriptions

##########################################################
#
# Jump out and set permissions recursively
#
##########################################################

cd ..
chown -R vpopmail:vchkpw *

Continue reading

CNN + Buzzwords = Holy crap you’re retarded.

CNN should probably look up the definition of what a hologram is before using the word over and over to describe something that is nothing more than a green screen video inlay.

Great job guys, once again proving that you really are as dumb as you look.

http://weename.com/2PRPV0

Twitter feed added to the site

As you can see, if you take a quick glance to your right on the screen; You will see that I have added a feed from my twitter updates.  Now that I have upgraded my stalkability I’m going to go have a scotch.

*cheers*

G’night

-SH

Oh Wired how you’ve let me down (again)

I’ve previously written about how Wired Magazine has become a advertising abomination.  It has happened yet again, throughout the multi hundred page magazine there is about 1.5 pages of actual meat. The rest is littered with half ass writing and advertisements.  They write about going green yet they deliver me a 2lb stack of paper worth nothing.  *sigh*