milter-greylist fails to restart after issuing 'systemctl restart milter-greylist.service'

Bug #1860407 reported by Frederick Zhang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
milter-greylist (Ubuntu)
New
Undecided
Unassigned

Bug Description

It seems that when issuing 'systemctl restart milter-greylist.service', it tries to start the new instance before the old one is completely gone.

Jan 21 06:13:48 Ubuntu milter-greylist[30663]: Stopping Greylist Mail Filter Daemon: greylist.
Jan 21 06:13:48 Ubuntu milter-greylist[30672]: Starting Greylist Mail Filter Daemon: process already running.
Jan 21 06:13:48 Ubuntu milter-greylist[30672]: greylist.
Jan 21 06:13:48 Ubuntu milter-greylist[1196]: greylist: mi_stop=1
Jan 21 06:13:48 Ubuntu milter-greylist[1196]: smfi_main() returned 0
Jan 21 06:13:48 Ubuntu milter-greylist[1196]: Final database dump: no change to dump

This is probably caused by the incorrect unit file generated by systemd:
$ systemctl cat milter-greylist.service
# /run/systemd/generator.late/milter-greylist.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/milter-greylist
Description=LSB: Script to start/stop the greylist-milter
Before=multi-user.target
Before=multi-user.target
Before=multi-user.target
Before=graphical.target
After=nss-lookup.target
After=remote-fs.target
After=sendmail.service

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
SuccessExitStatus=5 6
ExecStart=/etc/init.d/milter-greylist start
ExecStop=/etc/init.d/milter-greylist stop
ExecReload=/etc/init.d/milter-greylist reload

When restarting mitler-greylist, systemd executes '/etc/init.d/milter-greylist start' and '/etc/init.d/milter-greylist stop', however '/etc/init.d/milter-greylist restart' actually has got an additional '--retry 5' passed to 'start-stop-daemon --stop' so that start-stop-daemon can make sure that the process does finish.

An easy fix is to add --retry to '/etc/init.d/milter-greylist stop' as well. I've tested it and attached the patch here. But it'd be probably better to ship a proper systemd unit file.

Revision history for this message
Frederick Zhang (frederick888) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.