summaryrefslogtreecommitdiff
path: root/src/mailman/commands/docs/status.rst
blob: 7587157bc468b67e087ba188bc1b3d10968050cd (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 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 is running.

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

We shut down the master and confirm the status.

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