setup mailman on hosted1 and collab1 to prune old held msgs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



as per the discussion from last week. this patch prunes msgs older than 1 month from the held queue on our mailman servers.

-sv
commit 5f0f122245d1d1c5852e64b4ea74e8ef2454f6a7
Author: Seth Vidal <skvidal@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date:   Mon May 24 19:12:15 2010 +0000

    setup prune-old-heldmsgs to run every night to get rid of old heldmsgs
    do this the right way using crontab.in from mailman so that if mailman is
    off then it doesn't run

diff --git a/modules/mailman/files/crontab.in b/modules/mailman/files/crontab.in
new file mode 100644
index 0000000..9ede68a
--- /dev/null
+++ b/modules/mailman/files/crontab.in
@@ -0,0 +1,51 @@
+#
+# -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- 
+# ------------------  EDIT THE CORRECT FILE  -------------------------
+# 
+# This file is copied to /etc/cron.d/mailman from
+# /usr/lib/mailman/cron/crontab.in when the mailman service is started via its
+# init.d script and the file /etc/cron.d/mailman is removed when the
+# service is stopped.  Therefore any edits made directly to
+# /etc/cron.d/mailman will be lost anytime the mailman service
+# restarts.
+#
+# To make changes edit the master copy /usr/lib/mailman/cron/crontab.in and then
+# restart the service to pick up the changes (/sbin/service mailman restart).
+#
+# The reason this is done this way is because the mailman cron jobs
+# should only be invoked if the mailman service is enabled and not
+# just as a consequence of installing the rpm as was the case
+# previously. The file /etc/cron.d/mailman cannot simply be linked to
+# the master copy in /usr/lib/mailman/cron because for security reasons cron
+# will not process crontab files that are links or writeable by
+# anybody else but root, thus the file must be copied into /etc/cron.d
+# with the right ownership and permissions.
+#
+# At 8AM every day, mail reminders to admins as to pending requests.
+# They are less likely to ignore these reminders if they're mailed
+# early in the morning, but of course, this is local time... ;)
+0 8 * * * mailman /usr/lib/mailman/cron/checkdbs
+#
+# At 9AM, send notifications to disabled members that are due to be
+# reminded to re-enable their accounts.
+0 9 * * * mailman /usr/lib/mailman/cron/disabled
+#
+# Noon, mail digests for lists that do periodic as well as threshhold delivery.
+0 12 * * * mailman /usr/lib/mailman/cron/senddigests
+#
+# 5 AM on the first of each month, mail out password reminders.
+0 5 1 * * mailman /usr/lib/mailman/cron/mailpasswds
+#
+# Every 5 mins, try to gate news to mail.  You can comment this one out
+# if you don't want to allow gating, or don't have any going on right now,
+# or want to exclusively use a callback strategy instead of polling.
+0,5,10,15,20,25,30,35,40,45,50,55 * * * * mailman /usr/lib/mailman/cron/gate_news
+#
+# At 3:27am every night, regenerate the gzip'd archive file.  Only
+# turn this on if the internal archiver is used and
+# GZIP_ARCHIVE_TXT_FILES is false in mm_cfg.py
+27 3 * * * mailman /usr/lib/mailman/cron/nightly_gzip
+
+# At 2:27am every night, discard mail from the heldmsg queue that is older
+# than 1 month to help keep these to a minimum and from eating the dir alive
+27 2 * * * mailman /usr/local/bin/prune-old-heldmsgs.sh
diff --git a/modules/mailman/files/prune-old-heldmsgs.sh b/modules/mailman/files/prune-old-heldmsgs.sh
new file mode 100644
index 0000000..62f6710
--- /dev/null
+++ b/modules/mailman/files/prune-old-heldmsgs.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+declare -i old=`/bin/date -d "1 month ago" +%s`
+for file in /var/lib/mailman/data/heldmsg*.pck
+  do
+   declare -i age=`stat -c "%Y" $file`
+   if [ $age -lt $old ]; then
+       # do them one at a time so we can see when the 
+       # discard script explodes which file is the problem
+       /usr/lib/mailman/bin/discard -q $file
+   fi
+  done
diff --git a/modules/mailman/manifests/init.pp b/modules/mailman/manifests/init.pp
index 917d738..66901f2 100644
--- a/modules/mailman/manifests/init.pp
+++ b/modules/mailman/manifests/init.pp
@@ -58,6 +58,22 @@ class mailman::server {
             mode => 0755,
             source => "puppet:///mailman/fedora-mailing-list-setup";
 
+        "/usr/local/bin/prune-old-heldmsgs.sh":
+            ensure => present,
+            owner => root,
+            group => root,
+            mode => 0755,
+            source => "puppet:///mailman/prune-old-heldmsgs.sh";
+
+
+	"/usr/lib/mailman/cron/crontab.in":
+            ensure => present,
+            root => root,
+            group => mailman,
+            mode => 0755,
+            source => "puppet:///mailman/crontab.in",
+            notify => Service["mailman"];
+
         "/srv/mailman":
             ensure => directory,
             owner => root,
_______________________________________________
infrastructure mailing list
infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/infrastructure

[Index of Archives]     [Fedora Development]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux