LoginSignup
2
1

More than 5 years have passed since last update.

Mailman メーリングリストのシーケンス番号を移行する割りと楽な手順

Last updated at Posted at 2017-09-04
0. 前提
  1. CentOS[5-7]でしか検証していません。
  2. rpmパッケージによるデフォルトのインストールパスであることを想定しています。
1. 移行元サーバで下記コマンド群を実行し、ファイルにシーケンス番号をエクスポートする。
cat <<'__EOD__' >/tmp/mailman-get-sequence.sh
#!/bin/bash
ls /var/lib/mailman/lists/*/config.pck | while read LINE
do
    echo -n "$LINE" | sed -r 's@.+/([^/]*)/config.pck@\1@g'
    /usr/lib/mailman/bin/dumpdb -p $LINE \
      | grep "'post_id'" \
      | sed -r "s@[ \t]*'post_id': '?([0-9\.]+)'?,?@ \1@g"
done
#EOF
__EOD__
chmod 755 /tmp/mailman-get-sequence.sh
/tmp/mailman-get-sequence.sh | tee /tmp/mailman-sequence.txt
2. 上記により生成されたファイル/tmp/mailman-sequence.txtを、移行先サーバへコピー。
 移行先サーバの/tmp/mailman-sequence.txtへ配置する。
3. 移行先サーバで下記コマンドを実行し、インポート前のシーケンス番号を確認する。
ls /var/lib/mailman/lists/*/config.pck | while read LINE; do echo -n "$LINE" | sed -r 's@.+/([^/]*)/config.pck@\1@g'; /usr/lib/mailman/bin/dumpdb -p $LINE | grep "'post_id'" | sed -r "s@[ \t]*'post_id': '?([0-9\.]+)'?,?@ \1@g"; done
4. 移行先サーバで下記コマンド群を実行し、ファイルからシーケンス番号をインポートする。
cat <<'__EOD__' >/tmp/mailman-set-sequence.sh
#!/bin/bash
expect -c "
set timeout 4
spawn /usr/lib/mailman/bin/withlist -i -l $1
expect \">>>\"
send \"m.post_id=$2\\n\"
expect \">>>\"
send \"m.Save()\\n\"
expect \">>>\"
send \"quit()\\n\"
expect \"Any character string that will never be output.\"
exit 0
"
sleep 0.5
echo
#EOF
__EOD__
chmod 755 /tmp/mailman-set-sequence.sh
cat /tmp/mailman-sequence.txt | while read LINE; do /tmp/mailman-set-sequence.sh $LINE; done
5. 移行先サーバで下記コマンドを実行し、シーケンス番号が引き継がれていることを確認する。
ls /var/lib/mailman/lists/*/config.pck | while read LINE; do echo -n "$LINE" | sed -r 's@.+/([^/]*)/config.pck@\1@g'; /usr/lib/mailman/bin/dumpdb -p $LINE | grep 'post_id' | sed -r "s@[ \t]*'post_id': '?([0-9\.]+)'?,?@ \1@g"; done
おわり。
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1