1 --- mailman-2.1.23/bin/mailmanctl~ 2016-08-28 14:46:13.000000000 +0300
2 +++ mailman-2.1.23/bin/mailmanctl 2016-08-28 14:47:55.871820256 +0300
4 pid directly. The `start', `stop', `restart', and `reopen' commands handle
7 -Usage: %(PROGRAM)s [options] [ start | stop | restart | reopen ]
8 +Usage: %(PROGRAM)s [options] [ start | stop | restart | reopen | status ]
14 reopen - This will close all log files, causing them to be re-opened the
15 next time a message is written to them
17 + status - This returns a string indicating the status of the master
26 +def mailman_status():
27 + # return status, pid
29 + # These status values match the /etc/init.d status values
30 + # (at least on Red Hat), try to return equivalent status if possible
31 + # status is 0 if running,
32 + # status is 1 if dead but pid file exists
33 + # status is 2 if dead but subsys locked
34 + # status is 3 if stopped (pid returned will be 0)
37 + # We want any user to be able to query the status and this presents
38 + # few interesting permission problems and is why we don't use
39 + # qrunner_state(). The pidfile is only readable by the mailman owner
40 + # and group, however the lockfile is world readable. So we will
41 + # get the master pid from the lockfile. We try to determine if the
42 + # master process exists by sending it a signal. If we don't have
43 + # permission to signal the process, but the process exists we'll
44 + # get a EPERM error, if the process does not exist then we'll get
48 + hostname, pid, tempfile = get_lock_data()
50 + if e.errno == errno.ENOENT:
51 + # Lock file didn't exist, can't be running
55 + if hostname <> socket.gethostname():
56 + # not running on this host
58 + # Find out if the process exists by calling kill with a signal 0.
62 + if e.errno == errno.ESRCH:
63 + # process does not exist
65 + elif e.errno == errno.EPERM:
66 + # we don't have permission signal the process but it exists
73 def acquire_lock_1(force):
74 # Be sure we can acquire the master qrunner lock. If not, it means some
76 command = COMMASPACE.join(args)
77 usage(1, C_('Bad command: %(command)s'))
79 + # Handle the commands
80 + command = args[0].lower()
85 - print C_('Warning! You may encounter permission problems.')
86 + if command != 'status':
87 + print C_('Warning! You may encounter permission problems.')
89 - # Handle the commands
90 - command = args[0].lower()
92 # Sent the master qrunner process a SIGINT, which is equivalent to
93 # giving cron/qrunner a ctrl-c or KeyboardInterrupt. This will
96 print _('Re-opening all log files')
97 kill_watcher(signal.SIGHUP)
98 + elif command == 'status':
99 + status, pid = mailman_status()
102 + print _("mailman (pid %(pid)d) is running...")
104 + print _("mailman is stopped")
106 elif command == 'start':
107 # First, complain loudly if there's no site list.
108 check_for_site_list()
109 --- mailman-2.1.20/misc/mailman.in~ 2015-03-31 20:21:49.000000000 +0300
110 +++ mailman-2.1.20/misc/mailman.in 2015-05-25 11:22:11.283298992 +0300
113 MAILMANCTL=$MAILMANHOME/bin/mailmanctl
115 +# Source function library.
116 +. /etc/rc.d/init.d/functions
122 + msg_starting "$prog"
123 + daemon $PYTHON $MAILMANCTL -s -q start
125 + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
129 + msg_stopping "$prog"
130 + daemon $PYTHON $MAILMANCTL -q stop
132 + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
144 - #rm -f $MAILMANHOME/locks/*
145 - $PYTHON $MAILMANCTL -s -q start
150 - $PYTHON $MAILMANCTL -q stop
155 - $PYTHON $MAILMANCTL -q restart
160 $PYTHON $MAILMANCTL -q reopen
164 + $PYTHON $MAILMANCTL -q -u status
166 + if [ $retval -eq 0 ]; then
172 + $PYTHON $MAILMANCTL -u status