Bug#881329: systemd service

2017-11-10 Thread Stefan Bühler
Hi again,

I had to add

RestartPreventExitStatus=1

in [Service], because on certain failures (e.g. broken permissions in
the lock directory) mailmanctl forks and exits (which systemd considers
a successful start), and then the fork exits with status code 1.
Because it was started "successfully", systemd will trigger a restart
without limit...

It would be better if mailmanctl supported a flag to not fork mailmanctl
itself, but just run in the foreground (no need to close std{in,out,err}
either).  systemd (and other supervising init systems) can handle that
way better.

cheers,
Stefan



Bug#881329: systemd service

2017-11-10 Thread Stefan Bühler
Package: mailman
Version: 1:2.1.23-1+deb9u1

Hi,

it would be nice if the mailman package offered a real systemd service;
that way it could be automatically restarted on crashes (e.g.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=505638), and
`systemctl list-units --failed` would complain properly when it isn't
working.

For this I suggest these two files:

/usr/lib/tmpfiles.d/mailman.conf
---
# path  mode uid  gid
d /run/mailman  0755 list list
d /run/lock/mailman 2775 root list
---

(dh_installinit should create these automatically in .postinst when
systemd is active)

/lib/systemd/system/mailman.service
---
[Unit]
Description=Mailman Master Queue Runner
After=network.target

[Service]
Type=forking
PIDFile=/var/run/mailman/mailman.pid
ExecStart=/usr/lib/mailman/bin/mailmanctl -s start
ExecStop=/usr/lib/mailman/bin/mailmanctl stop
ExecReload=/usr/lib/mailman/bin/mailmanctl restart
Restart=always
RestartSec=3s

[Install]
WantedBy=multi-user.target
Alias=mailman-qrunner.service
---

mailmanctl checks for the existence of the site list on start itself, I
don't see any need to keep/clone this logic.

In [Unit] one could add:
---
ConditionFileIsExecutable=/usr/bin/python
---
to replicate the check from the init script.

cheers,
Stefan