summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cron/bumpdigests91
1 files changed, 91 insertions, 0 deletions
diff --git a/cron/bumpdigests b/cron/bumpdigests
new file mode 100644
index 000000000..2795ced8b
--- /dev/null
+++ b/cron/bumpdigests
@@ -0,0 +1,91 @@
+#! /usr/bin/env python
+#
+# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+"""Increment the digest volume number and reset the digest number to zero.
+
+Usage: %(PROGRAM)s [options] [listname ...]
+
+Options:
+
+ --help/-h
+ Print this message and exit.
+
+The lists named on the command line are bumped. If no list names are given,
+all lists are bumped.
+"""
+
+import sys
+import getopt
+
+import paths
+from Mailman import MailList
+from Mailman import Utils
+from Mailman import Errors
+
+# Work around known problems with some RedHat cron daemons
+import signal
+signal.signal(signal.SIGCHLD, signal.SIG_DFL)
+
+PROGRAM = sys.argv[0]
+
+
+
+def usage(code, msg=''):
+ print __doc__ % globals()
+ if msg:
+ print msg
+ sys.exit(code)
+
+
+
+def main():
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], 'h', ['help'])
+ except getopt.error, msg:
+ usage(1, msg)
+
+ for opt, arg in opts:
+ if opt in ('-h', '--help'):
+ usage(0)
+
+ if args:
+ listnames = args
+ else:
+ listnames = Utils.list_names()
+
+ if not listnames:
+ print 'Nothing to do.'
+ sys.exit(0)
+
+ for listname in listnames:
+ try:
+ # be sure the list is locked
+ mlist = MailList.MailList(listname)
+ except Errors.MMListError, e:
+ usage(1, 'No such list: %s' % listname)
+ try:
+ mlist.volume = mlist.volume + 1
+ mlist.next_digest_number = 1
+ finally:
+ mlist.Save()
+ mlist.Unlock()
+
+
+
+if __name__ == '__main__':
+ main()