[Dovecot] Backing Up To Windows File Server

Luigi Rosa lists at luigirosa.com
Wed Dec 14 19:34:52 EET 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Asai said the following on 14/12/11 17:52:

> Thanks, Luigi, I may fall back to that.

Should you need it, here's the script I use to do it.

In my configurations /var/spool/mail contains one dir for each domain and each
of that dir contains a maildir for each domain. So the email of
foobar at acme.com is in /var/spool/mail/acme.com/foobar/

The 4th line checks lost&found because /bar/spool/mail is a different file system.

I create the .tgz file on local /tmp for performance reasons.



TARGET=/backup
for DOMAINPATH in /var/spool/mail/*
do
	if [ "${DOMAINPATH}" != "/var/spool/mail/lost+found" ]
	then
		DOMAIN=`echo $DOMAINPATH | cut -d '/' -f 5`
		for USERPATH in ${DOMAINPATH}/*
		do
			USER=`echo $USERPATH | cut -d '/' -f 6`
			tar cvzf /tmp/$DOMAIN-$USER.tgz $USERPATH > /dev/null
			cp -f /tmp/$DOMAIN-$USER.tgz $TARGET/mail
			rm -f /tmp/$DOMAIN-$USER.tgz
		done
	fi

done





Ciao,
luigi

- -- 
/
+--[Luigi Rosa]--
\

I don't think we have the right or the wisdom to interfere,
however a planet is evolving.
    --James Kirk, "The Omega Glory"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7o3jYACgkQ3kWu7Tfl6ZSfpQCgvzhOJH6mnJMu8ZzvKu5y8um+
46wAoKd0eXxBNPad9EZao7VKjZBkACer
=dhk0
-----END PGP SIGNATURE-----


More information about the dovecot mailing list