[Mailman-Users] Downloading a copy of the users emails?

Mark T. Valites valites at geneseo.edu
Fri Oct 19 22:44:52 CEST 2001


Ah, but if you want to preserve the preferences, settings, and archives
from a previous install, there is a little more to it.  I did this from
one machine to itself, and also an nfs mount to another machine.  There
may be bugs, and I'm a little new to bash scripting, but here's what I ended
up doing:

#!/usr/bin/bash

orig_mailman_dir=/home/mailman_old
new_mailman_dir=/home/mailman
bin_dir=/home/mailman/bin
private_file=$orig_mailman_dir/mk_private
alias_file=/etc/mail/aliases
person_to_nag_with_700_emails=someone at emailaddress.com

if [[ -f $private_file && -d $orig_mailman_dir && -d $new_mailman_dir ]]
    then

    if cd "$orig_mailman_dir/lists/"
    	then
	echo ""
	for list_name in *
	    do

		### newlist ###
		echo
"*********************************************************************"
		echo "Adding list: $list_name..."
		$bin_dir/newlist -q --output=/etc/mail/aliases $list_name
$person_to_nag_with_700_emails $list_name"monkey"
		if [ "$?" -ne "0" ]
		    then
			echo "Danger Will Robinson: Could not create list
$list_name."
		fi
		### end newlist ###


		### check for privacy ###
		#   check "archive_private" field from dumpdb on config.db
		#   1 = private
		#   0 = public
		result=`$bin_dir/dumpdb $list_name/config.db | grep
archive_private | awk '{print $2}' | sed s/,//`
		if [ "$result" -eq "1" ]
		    then
			echo "$list_name appears to be a private list."
			echo "Making new $list_name list private..."
		    ### make list private ###
		    $bin_dir/config_list -i $private_file $list_name
		    if [ "$?" -ne "0" ]
			then
			    $echo "Danger Will Robinson: There was a
problem making new list $list_name private."
		    fi
		    ### end make list private ###
		elif [ "$result" -eq "0" ]
		    then
			echo "$list_name appears to be a public list."
		else
		    echo "Danger Will Robinson: There appears to have been
a problem checking $list_name."
		fi
		### end check for privacy ###


		### archival removal ###
		echo "Removing stock archive:
$new_mailman_dir/archives/private/$list_name.mbox ..."
		rm -rf $new_mailman_dir/archives/private/$list_name*
		if [ "$?" -ne "0" ]
		    then
			$echo "Danger Will Robinson: There was a problem
removing stock archives from
$new_mailman_dir/archives/private/$list_name.mbox for list $list_name."
		fi
		### end archival removal ###


		### cp archives ###
		echo "Restoring original archive from:
$orig_mailman_dir/archives/private/ ..."
		cp -r $orig_mailman_dir/archives/private/$list_name*
$new_mailman_dir/archives/private/
		if [ "$?" -ne "0" ]
		    then
			$echo "Danger Will Robinson: There was a problem
restoring original archive from
$orig_mailman_dir/archives/private/$list_name.mbox for list $list_name."
		fi
		### end cp archives ###


		### remove list files ###
		echo "Removing all stock files in:
$new_mailman_dir/lists/$list_name/ ..."
		rm -f $new_mailman_dir/lists/$list_name/*
		if [ "$?" -ne "0" ]
		    then
			$echo "Danger Will Robinson: There was a problem
removing all stock files in $new_mailman_dir/lists/$list_name for list
$list_name."
		fi
		echo "Restoring all files from original directory:"
		echo "   $orig_mailman_dir/lists/$list_name/"
		echo "   to: $new_mailman_dir/lists/$list_name/ ..."
		### end remove list files ###


		### restore list files ###
		cp -R $orig_mailman_dir/lists/$list_name/*
$new_mailman_dir/lists/$list_name/
		if [ "$?" -ne "0" ]
		    then
			echo "Danger Will Robinson: There was a problem
restoring files from $orig_mailman_dir/lists/$list_name to
$new_mailman_dir/lists/$list_name for list $list_name."
		fi
		### end restore list files ###

		echo
"*********************************************************************"
		echo ""
	    done
	else
	    echo "Danger Will Robinson: Could not change directories to
$orig_mailman_dir/lists."
	    echo "Nothing was done."
	fi

else
    echo "One of the following files or directories was missing:"
    echo "The mk_private file of form:"
    echo "     archive_private = 1"
    echo "or the original mailman install directory, or the new mailman
install directory."
    echo "Nothing was done."
fi

exit 0




> Date: Fri, 19 Oct 2001 13:29:08 -0700
> From: Amanda <arandall at auntminnie.com>
> To: Jeremy Luebke - RockHosting.com <jeremy at rockhosting.com>
> Cc: mailman-users at python.org
> Subject: Re: [Mailman-Users] Downloading a copy of the users emails?
>
> Hm. Do folks not know of the existence of the bin directory, or are they
> frightened of it? I suppose I use the same methods of evaluating and exploring
> software that I do when playing that minefield game... make your best guess,
> and then click on it and see if it blows up...
>
> Jeremy: cd to wherever/mailman/bin and do:
> ./list_members listname > flatfile.txt
>
> =)
> Amanda
>
>
> "Jeremy Luebke - RockHosting.com" wrote:
>
> > Is there a way that I can download a copy of all my members email addresses
> > so I can transfer them to a different program on a different server?
> >
> > Thanks
> >
> > ------------------------------------------------------
> > Mailman-Users maillist  -  Mailman-Users at python.org
> > http://mail.python.org/mailman/listinfo/mailman-users
>
>
> ------------------------------------------------------
> Mailman-Users maillist  -  Mailman-Users at python.org
> http://mail.python.org/mailman/listinfo/mailman-users
>





More information about the Mailman-Users mailing list