[mhonarc] actually call mhonarc and add some comments
- From: Olav Vitters <ovitters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mhonarc] actually call mhonarc and add some comments
- Date: Tue, 12 Feb 2013 09:21:21 +0000 (UTC)
commit 7c4b125b4afe8cb282cd72cf72498fcd0b4f843f
Author: Olav Vitters <olav vitters nl>
Date: Tue Feb 12 10:21:15 2013 +0100
actually call mhonarc and add some comments
archive.py | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/archive.py b/archive.py
index e09ef19..d230c8d 100755
--- a/archive.py
+++ b/archive.py
@@ -16,6 +16,8 @@ class Archiver:
PRIVATE_ARCHIVE_DIR = "/var/lib/mailman/archives/private"
PRIVATE_RCFILE = "/home/admin/mhonarc/private-rc/base.rc"
+ ERRORLOG = "/var/log/mailman/archive"
+
MONTHS = {
'january': 1,
'february': 2,
@@ -53,10 +55,14 @@ class Archiver:
rcfile = self.PRIVATE_RCFILE if self.private else self.PUBLIC_RCFILE
-# system (<<EOT);
-# mhonarc -umask 022 -rcfile $rcfile -add -outdir $dir $tmpname -definevar "ARCHDATE=$self->{olddir} LISTNAME=$self->{listname}" >> /var/log/mailman/archive 2>&1
-# EOT
+ # Call mhonarc for all messages in 'tmpfile'
+ with open(self.ERRORLOG, "a") as error_fd:
+ cmd = ['mhonarc', '-umask', '022', '-rcfile', rcfile, '-add', '-output', path, tmpname,
+ '-definevar', 'ARCHDATE=%s LISTNAME=%s' % (self.olddir, self.listname)]
+
+ subprocess.call(cmd, stdout=error_fd, stderr=subprocess.STDOUT)
+ # Append message(s) to mbox (possibly gzipped)
if os.path.exists("%s.txt" % path):
fp = open("%s.txt" % path, 'ab')
else:
@@ -143,7 +149,7 @@ def mkdate(datestr):
def main():
- description = """Archive email using mhonarc from individual files or an Unix mbox."""
+ description = """Archive an email or an mbox per month using mhonarc"""
epilog="""Report bugs to https://bugzilla.gnome.org/enter_bug.cgi?product=sysadmin"""
parser = argparse.ArgumentParser(description=description,epilog=epilog)
parser.add_argument('--debug', action='store_true')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]