diff options
| author | bwarsaw | 1999-11-10 19:47:05 +0000 |
|---|---|---|
| committer | bwarsaw | 1999-11-10 19:47:05 +0000 |
| commit | 9f6ebef593b52c38e495a1a14ca30348d3287112 (patch) | |
| tree | e5535f2f9e8ee188b506c1acbf0c5ee4f105bc08 | |
| parent | 7ce28adb4a4134c8f8f1749361cef1f73c4c8088 (diff) | |
| download | mailman-9f6ebef593b52c38e495a1a14ca30348d3287112.tar.gz mailman-9f6ebef593b52c38e495a1a14ca30348d3287112.tar.zst mailman-9f6ebef593b52c38e495a1a14ca30348d3287112.zip | |
main(): Convert to new pipeline architecture.
| -rwxr-xr-x | cron/senddigests | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/cron/senddigests b/cron/senddigests index f66d814cb..fde831d53 100755 --- a/cron/senddigests +++ b/cron/senddigests @@ -18,24 +18,40 @@ """Dispatch digests for lists w/pending messages and digest_send_periodic set. -Typically it's invoked via cron.""" +Typically it's invoked via cron. +""" -import sys, os +import sys +import os +from stat import ST_SIZE +from errno import ENOENT import paths from Mailman import MailList from Mailman import Utils +from Mailman.Handlers import ToDigest # Work around known problems with some RedHat cron daemons import signal signal.signal(signal.SIGCHLD, signal.SIG_DFL) + def main(): + for listname in Utils.list_names(): + mlist = MailList.MailList(name, lock=0) + if mlist.digest_send_periodic: + # send the digest if there are any partially built + digestfile = os.path.join(mlist.fullpath(), 'next-digest') + topicsfile = os.path.join(mlist.fullpath(), 'next-digest-topics') + try: + if os.stat(digestfile)[ST_SIZE] > 0: + ToDigest.inject_digest(mlist, digestfile, topicsfile) + except os.error, (code, msg): + if code == ENOENT: + mlist.LogMsg('error', '%s: lost digest file: %s (%s)' % + (listname, digestfile, msg)) + else: + raise - for name in Utils.list_names(): - list = MailList.MailList(name, lock=0) - if list.digest_send_periodic: - # Send if there are any messages pending. - list.SendDigestIfAny() - + if __name__ == "__main__": main() |
