summaryrefslogtreecommitdiff
path: root/src/mailman/commands/docs/status.txt
blob: 6deb7fdc08435a8fc89b82e0cb9020335a862682 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
==============
Getting status
==============

The status of the Mailman master process can be queried from the command line.
It's clear at this point that nothing is running.
::

    >>> from mailman.commands.cli_status import Status
    >>> status = Status()

    >>> class FakeArgs:
    ...     pass

The status is printed to stdout and a status code is returned.

    >>> status.process(FakeArgs)
    GNU Mailman is not running
    0

We can simulate the master queue runner starting up by acquiring its lock.

    >>> from flufl.lock import Lock
    >>> lock = Lock(config.LOCK_FILE)
    >>> lock.lock()

Getting the status confirms that the master queue runner is running.

    >>> status.process(FakeArgs)
    GNU Mailman is running (master pid: ...

We shutdown the master queue runner, and confirm the status.

    >>> lock.unlock()
    >>> status.process(FakeArgs)
    GNU Mailman is not running
    0