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