Blame SOURCES/mailman-2.1.11-cron.patch

e7a395
diff --git a/cron/bumpdigests b/cron/bumpdigests
e7a395
index 57cc45e..4002731 100755
e7a395
--- a/cron/bumpdigests
e7a395
+++ b/cron/bumpdigests
e7a395
@@ -1,4 +1,4 @@
e7a395
-#! @PYTHON@
e7a395
+#! @PYTHON@ -S
e7a395
 #
e7a395
 # Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
e7a395
 #
e7a395
diff --git a/cron/checkdbs b/cron/checkdbs
e7a395
index e776f15..c4d8179 100755
e7a395
--- a/cron/checkdbs
e7a395
+++ b/cron/checkdbs
e7a395
@@ -1,4 +1,4 @@
e7a395
-#! @PYTHON@
e7a395
+#! @PYTHON@ -S
e7a395
 #
e7a395
 # Copyright (C) 1998-2011 by the Free Software Foundation, Inc.
e7a395
 #
e7a395
diff --git a/cron/crontab.in.in b/cron/crontab.in.in
e7a395
index 540dfc1..45c5022 100644
e7a395
--- a/cron/crontab.in.in
e7a395
+++ b/cron/crontab.in.in
e7a395
@@ -1,27 +1,50 @@
e7a395
+#
e7a395
+# -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- WARNING -- 
e7a395
+# ------------------  EDIT THE CORRECT FILE  -------------------------
e7a395
+# 
e7a395
+# This file is copied to /etc/cron.d/mailman from
e7a395
+# @prefix@/cron/crontab.in when the mailman service is started via its
e7a395
+# init.d script and the file /etc/cron.d/mailman is removed when the
e7a395
+# service is stopped.  Therefore any edits made directly to
e7a395
+# /etc/cron.d/mailman will be lost anytime the mailman service
e7a395
+# restarts.
e7a395
+#
e7a395
+# To make changes edit the master copy @prefix@/cron/crontab.in and then
e7a395
+# restart the service to pick up the changes (/sbin/service mailman restart).
e7a395
+#
e7a395
+# The reason this is done this way is because the mailman cron jobs
e7a395
+# should only be invoked if the mailman service is enabled and not
e7a395
+# just as a consequence of installing the rpm as was the case
e7a395
+# previously. The file /etc/cron.d/mailman cannot simply be linked to
e7a395
+# the master copy in @prefix@/cron because for security reasons cron
e7a395
+# will not process crontab files that are links or writeable by
e7a395
+# anybody else but root, thus the file must be copied into /etc/cron.d
e7a395
+# with the right ownership and permissions.
e7a395
+#
e7a395
 # At 8AM every day, mail reminders to admins as to pending requests.
e7a395
 # They are less likely to ignore these reminders if they're mailed
e7a395
 # early in the morning, but of course, this is local time... ;)
e7a395
-0 8 * * * @PYTHON@ -S @prefix@/cron/checkdbs
e7a395
+0 8 * * * @MAILMAN_USER@ @prefix@/cron/checkdbs
e7a395
 #
e7a395
 # At 9AM, send notifications to disabled members that are due to be
e7a395
 # reminded to re-enable their accounts.
e7a395
-0 9 * * * @PYTHON@ -S @prefix@/cron/disabled
e7a395
+0 9 * * * @MAILMAN_USER@ @prefix@/cron/disabled
e7a395
 #
e7a395
 # Noon, mail digests for lists that do periodic as well as threshhold delivery.
e7a395
-0 12 * * * @PYTHON@ -S @prefix@/cron/senddigests
e7a395
+0 12 * * * @MAILMAN_USER@ @prefix@/cron/senddigests
e7a395
 #
e7a395
 # 5 AM on the first of each month, mail out password reminders.
e7a395
-0 5 1 * * @PYTHON@ -S @prefix@/cron/mailpasswds
e7a395
+0 5 1 * * @MAILMAN_USER@ @prefix@/cron/mailpasswds
e7a395
 #
e7a395
 # Every 5 mins, try to gate news to mail.  You can comment this one out
e7a395
 # if you don't want to allow gating, or don't have any going on right now,
e7a395
 # or want to exclusively use a callback strategy instead of polling.
e7a395
-0,5,10,15,20,25,30,35,40,45,50,55 * * * * @PYTHON@ -S @prefix@/cron/gate_news
e7a395
+0,5,10,15,20,25,30,35,40,45,50,55 * * * * @MAILMAN_USER@ @prefix@/cron/gate_news
e7a395
 #
e7a395
 # At 3:27am every night, regenerate the gzip'd archive file.  Only
e7a395
 # turn this on if the internal archiver is used and
e7a395
 # GZIP_ARCHIVE_TXT_FILES is false in mm_cfg.py
e7a395
-27 3 * * * @PYTHON@ -S @prefix@/cron/nightly_gzip
e7a395
+27 3 * * * @MAILMAN_USER@ @prefix@/cron/nightly_gzip
e7a395
 #
e7a395
 # At 4:30AM daily, cull old entries from the 'bad' and 'shunt' queues.
e7a395
-30 4 * * * @PYTHON@ -S @prefix@/cron/cull_bad_shunt
e7a395
+30 4 * * * @MAILMAN_USER@ @prefix@/cron/cull_bad_shunt
e7a395
diff --git a/cron/disabled b/cron/disabled
e7a395
index ac62582..971563d 100755
e7a395
--- a/cron/disabled
e7a395
+++ b/cron/disabled
e7a395
@@ -1,4 +1,4 @@
e7a395
-#! @PYTHON@
e7a395
+#! @PYTHON@ -S
e7a395
 #
e7a395
 # Copyright (C) 2001-2007 by the Free Software Foundation, Inc.
e7a395
 #
e7a395
diff --git a/cron/gate_news b/cron/gate_news
e7a395
index c66c09e..247c834 100755
e7a395
--- a/cron/gate_news
e7a395
+++ b/cron/gate_news
e7a395
@@ -1,4 +1,4 @@
e7a395
-#! @PYTHON@
e7a395
+#! @PYTHON@ -S
e7a395
 #
e7a395
 # Copyright (C) 1998-2011 by the Free Software Foundation, Inc.
e7a395
 #
e7a395
diff --git a/cron/mailpasswds b/cron/mailpasswds
e7a395
index 5745265..4d0cd3a 100755
e7a395
--- a/cron/mailpasswds
e7a395
+++ b/cron/mailpasswds
e7a395
@@ -1,4 +1,4 @@
e7a395
-#! @PYTHON@
e7a395
+#! @PYTHON@ -S
e7a395
 #
e7a395
 # Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
e7a395
 #
e7a395
diff --git a/cron/nightly_gzip b/cron/nightly_gzip
e7a395
index 0a0f4e3..7dba3b1 100755
e7a395
--- a/cron/nightly_gzip
e7a395
+++ b/cron/nightly_gzip
e7a395
@@ -1,4 +1,4 @@
e7a395
-#! @PYTHON@
e7a395
+#! @PYTHON@ -S
e7a395
 # 
e7a395
 # Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
e7a395
 #
e7a395
diff --git a/cron/senddigests b/cron/senddigests
e7a395
index edf27a2..c64adc1 100755
e7a395
--- a/cron/senddigests
e7a395
+++ b/cron/senddigests
e7a395
@@ -1,4 +1,4 @@
e7a395
-#! @PYTHON@
e7a395
+#! @PYTHON@ -S
e7a395
 #
e7a395
 # Copyright (C) 1998-2007 by the Free Software Foundation, Inc.
e7a395
 #
e7a395
diff --git a/misc/mailman.in b/misc/mailman.in
e7a395
index bce344c..7129f14 100644
e7a395
--- a/misc/mailman.in
e7a395
+++ b/misc/mailman.in
e7a395
@@ -24,18 +24,48 @@
e7a395
 # On Debian, type "update-rc.d mailman defaults"
e7a395
 # On RedHat, and derivatives, install with "chkconfig --add mailman"
e7a395
 #
e7a395
-# chkconfig: 2345 98 12
e7a395
+# chkconfig: - 98 12
e7a395
 # description: Mailman is the GNU Mailing List Manager, a program that \
e7a395
 #              manages electronic mail discussion groups.  For more \
e7a395
 #              on GNU Mailman see http://www.list.org
e7a395
 # processname: mailmanctl
e7a395
 # config: @prefix@/Mailman/mm_cfg.py
e7a395
-# pidfile: @prefix@/data/master-qrunner.pid
e7a395
+# pidfile: @PID_DIR@/master-qrunner.pid
e7a395
 
e7a395
 PYTHON=@PYTHON@
e7a395
 MAILMANHOME=@prefix@
e7a395
 MAILMANCTL=$MAILMANHOME/bin/mailmanctl
e7a395
 
e7a395
+# We used to install the mailman cron jobs when the mailman rpm was
e7a395
+# installed, irrespective of whether mailman was actually being
e7a395
+# run. Although the cron jobs didn't create any problems if someone
e7a395
+# wasn't running mailman some users complained about the cron log file
e7a395
+# filling up, resource usage, and power consumption since systems
e7a395
+# wouldn't really idle. It really only makes sense to run the mailman
e7a395
+# cron jobs if the mailman service is turned on and not just merely
e7a395
+# having the rpm installed. This init.d script is an obvious place to
e7a395
+# install or remove the cron jobs based on the service being enabled
e7a395
+# or not.
e7a395
+
e7a395
+SRC_CRON_SCRIPT=$MAILMANHOME/cron/crontab.in
e7a395
+DST_CRON_SCRIPT=/etc/cron.d/mailman
e7a395
+
e7a395
+function InstallCron()
e7a395
+{
e7a395
+    install -m644 -o root -g root $SRC_CRON_SCRIPT $DST_CRON_SCRIPT
e7a395
+}
e7a395
+
e7a395
+function RemoveCron()
e7a395
+{
e7a395
+cat > $DST_CRON_SCRIPT <
e7a395
+# DO NOT EDIT THIS FILE!
e7a395
+#
e7a395
+# Contents of this file managed by /etc/init.d/mailman
e7a395
+# Master copy is @prefix@/cron/crontab.in
e7a395
+# Consult that file for documentation
e7a395
+EOF
e7a395
+}
e7a395
+
e7a395
 # Source function library.
e7a395
 . /etc/rc.d/init.d/functions
e7a395
 
e7a395
@@ -47,7 +77,11 @@ function start()
e7a395
     echo -n $"Starting $prog: "
e7a395
     daemon $PYTHON $MAILMANCTL -s -q start
e7a395
     RETVAL=$?
e7a395
-    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
e7a395
+    if [ $RETVAL -eq 0 ]
e7a395
+    then
e7a395
+	touch /var/lock/subsys/$prog
e7a395
+	InstallCron
e7a395
+    fi
e7a395
     echo
e7a395
     return $RETVAL
e7a395
 }
e7a395
@@ -57,7 +91,11 @@ function stop()
e7a395
     echo -n $"Shutting down $prog: "
e7a395
     daemon $PYTHON $MAILMANCTL -q stop
e7a395
     RETVAL=$?
e7a395
-    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
e7a395
+    if [ $RETVAL -eq 0 ]
e7a395
+    then
e7a395
+	rm -f /var/lock/subsys/$prog
e7a395
+	RemoveCron
e7a395
+    fi
e7a395
     echo
e7a395
     return $RETVAL
e7a395
 }
e7a395
@@ -101,5 +139,9 @@ case "$1" in
e7a395
     RETVAL=$?
e7a395
     ;;
e7a395
 
e7a395
+*)
e7a395
+    echo $"Usage: $prog {start|stop|restart|condrestart|status}"
e7a395
+    ;;
e7a395
+
e7a395
 esac
e7a395
 exit $RETVAL