1 diff -urNp -x '*.orig' mailman-2.1.34.org/bin/mailmanctl mailman-2.1.34/bin/mailmanctl
2 --- mailman-2.1.34.org/bin/mailmanctl 2020-06-27 02:21:21.000000000 +0200
3 +++ mailman-2.1.34/bin/mailmanctl 2021-10-23 13:32:24.269240325 +0200
4 @@ -36,7 +36,7 @@ in the file data/master-qrunner.pid but
5 pid directly. The `start', `stop', `restart', and `reopen' commands handle
8 -Usage: %(PROGRAM)s [options] [ start | stop | restart | reopen ]
9 +Usage: %(PROGRAM)s [options] [ start | stop | restart | reopen | status ]
13 @@ -90,6 +90,9 @@ Commands:
15 reopen - This will close all log files, causing them to be re-opened the
16 next time a message is written to them
18 + status - This returns a string indicating the status of the master
23 @@ -190,6 +193,52 @@ def qrunner_state():
27 +def mailman_status():
28 + # return status, pid
30 + # These status values match the /etc/init.d status values
31 + # (at least on Red Hat), try to return equivalent status if possible
32 + # status is 0 if running,
33 + # status is 1 if dead but pid file exists
34 + # status is 2 if dead but subsys locked
35 + # status is 3 if stopped (pid returned will be 0)
38 + # We want any user to be able to query the status and this presents
39 + # few interesting permission problems and is why we don't use
40 + # qrunner_state(). The pidfile is only readable by the mailman owner
41 + # and group, however the lockfile is world readable. So we will
42 + # get the master pid from the lockfile. We try to determine if the
43 + # master process exists by sending it a signal. If we don't have
44 + # permission to signal the process, but the process exists we'll
45 + # get a EPERM error, if the process does not exist then we'll get
49 + hostname, pid, tempfile = get_lock_data()
51 + if e.errno == errno.ENOENT:
52 + # Lock file didn't exist, can't be running
56 + if hostname <> socket.gethostname():
57 + # not running on this host
59 + # Find out if the process exists by calling kill with a signal 0.
63 + if e.errno == errno.ESRCH:
64 + # process does not exist
66 + elif e.errno == errno.EPERM:
67 + # we don't have permission signal the process but it exists
74 def acquire_lock_1(force):
75 # Be sure we can acquire the master qrunner lock. If not, it means some
76 @@ -338,13 +387,15 @@ def main():
77 command = COMMASPACE.join(args)
78 usage(1, C_('Bad command: %(command)s'))
80 + # Handle the commands
81 + command = args[0].lower()
86 - print C_('Warning! You may encounter permission problems.')
87 + if command != 'status':
88 + print C_('Warning! You may encounter permission problems.')
90 - # Handle the commands
91 - command = args[0].lower()
93 # Sent the master qrunner process a SIGINT, which is equivalent to
94 # giving cron/qrunner a ctrl-c or KeyboardInterrupt. This will
95 @@ -363,6 +414,14 @@ def main():
97 print C_('Re-opening all log files')
98 kill_watcher(signal.SIGHUP)
99 + elif command == 'status':
100 + status, pid = mailman_status()
103 + print _("mailman (pid %(pid)d) is running...")
105 + print _("mailman is stopped")
107 elif command == 'start':
108 # First, complain loudly if there's no site list.
109 check_for_site_list()
110 diff -urNp -x '*.orig' mailman-2.1.34.org/misc/mailman.in mailman-2.1.34/misc/mailman.in
111 --- mailman-2.1.34.org/misc/mailman.in 2020-06-27 02:21:21.000000000 +0200
112 +++ mailman-2.1.34/misc/mailman.in 2021-10-23 13:32:24.269240325 +0200
113 @@ -49,23 +49,61 @@ PYTHON=@PYTHON@
115 MAILMANCTL=$MAILMANHOME/bin/mailmanctl
117 +# Source function library.
118 +. /etc/rc.d/init.d/functions
124 + msg_starting "$prog"
125 + daemon $PYTHON $MAILMANCTL -s -q start
127 + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
131 + msg_stopping "$prog"
132 + daemon $PYTHON $MAILMANCTL -q stop
134 + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
146 - #rm -f $MAILMANHOME/locks/*
147 - $PYTHON $MAILMANCTL -s -q start
152 - $PYTHON $MAILMANCTL -q stop
157 - $PYTHON $MAILMANCTL -q restart
162 $PYTHON $MAILMANCTL -q reopen
166 + $PYTHON $MAILMANCTL -q -u status
168 + if [ $retval -eq 0 ]; then
174 + $PYTHON $MAILMANCTL -u status