1 # Copyright (C) 1998-2015 by the Free Software Foundation, Inc.
3 # This file is part of GNU Mailman.
5 # GNU Mailman is free software: you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option)
10 # GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 # You should have received a copy of the GNU General Public License along with
16 # GNU Mailman. If not, see <http://www.gnu.org/licenses/>.
22 from mailman
import MailList
23 from mailman
.core
.i18n
import _
24 from mailman
.initialize
import initialize
25 from mailman
.version
import MAILMAN_VERSION
27 # Work around known problems with some RedHat cron daemons
29 signal
.signal(signal
.SIGCHLD
, signal
.SIG_DFL
)
34 parser
= optparse
.OptionParser(version
=MAILMAN_VERSION
,
38 Dispatch digests for lists w/pending messages and digest_send_periodic
40 parser
.add_option('-l', '--listname',
41 type='string', default
=[], action
='append',
42 dest
='listnames', help=_("""\
43 Send the digest for the given list only, otherwise the digests for all
44 lists are sent out. Multiple -l options may be given."""))
45 parser
.add_option('-C', '--config',
46 help=_('Alternative configuration file to use'))
47 opts
, args
= parser
.parse_args()
50 print >> sys
.stderr
, _('Unexpected arguments')
52 return opts
, args
, parser
57 opts
, args
, parser
= parseargs()
58 initialize(opts
.config
)
60 for listname
in set(opts
.listnames
or config
.list_manager
.names
):
61 mlist
= MailList
.MailList(listname
, lock
=False)
62 if mlist
.digest_send_periodic
:
66 mlist
.send_digest_now()
68 # We are unable to predict what exception may occur in digest
69 # processing and we don't want to lose the other digests, so
70 # we catch everything.
71 except Exception as errmsg
:
72 print >> sys
.stderr
, \
73 'List: %s: problem processing %s:\n%s' % \
75 os
.path
.join(mlist
.data_path
, 'digest.mbox'),
82 if __name__
== '__main__':