DevHeads.net

reloading postfix with systemd

In v16.04 LTS, Ubuntu has switched to systemd.

"postfix reload" still seems to work just fine.
But I wonder if I should be using "systemctl reload postfix" instead.

Which method is preferred on systems that use systemd?
And if either method works, are there differences or reasons to prefer one
over the other?

Thanks,
Michael

Comments

Re: reloading postfix with systemd

By Julian Kippels at 08/10/2017 - 12:34

Am Thu, 10 Aug 2017 10:19:25 -0700
schrieb "Michael Fox" < ... at mefox dot org>:

Well at least in Redhat, if you do systemctl reload postfix it just
executes postfix reload internally. So it makes absolutely no
difference.

# cat /usr/lib/systemd/system/postfix.service
[Unit]
Description=Postfix Mail Transport Agent
After=syslog.target network.target
Conflicts=sendmail.service exim.service

[Service]
Type=forking
PIDFile=/var/spool/postfix/pid/master.pid
EnvironmentFile=-/etc/sysconfig/network
ExecStartPre=-/usr/libexec/postfix/aliasesdb
ExecStartPre=-/usr/libexec/postfix/chroot-update
ExecStart=/usr/sbin/postfix start
ExecReload=/usr/sbin/postfix reload
ExecStop=/usr/sbin/postfix stop

[Install]
WantedBy=multi-user.target

RE: reloading postfix with systemd

By Michael Fox at 08/10/2017 - 14:20

Hmm. My Ubuntu system has no such file.

~$ sudo systemctl status postfix.service
● postfix.service - LSB: Postfix Mail Transport Agent
Loaded: loaded (/etc/init.d/postfix; bad; vendor preset: enabled)
Drop-In: /run/systemd/generator/postfix.service.d
└─50-postfix-$mail-transport-agent.conf
Active: active (running) since Wed 2017-08-09 10:20:02 PDT; 1 day 1h ago
Docs: man:systemd-sysv-generator(8)
Tasks: 4
Memory: 6.5M
CPU: 1.836s
CGroup: /system.slice/postfix.service
├─ 1971 /usr/lib/postfix/sbin/master
├─20028 qmgr -l -t unix -u
├─20030 pickup -l -t unix -u -c
└─20039 tlsmgr -l -t unix -u -c

I'm a newbie to systemd. But I guess the above is telling me that the
postfix.service is auto-generated.
Looking at the file listed in "Drop-In", I don't see the reload command.

$ cat
/run/systemd/generator/postfix.service.d/50-postfix-\$mail-transport-agent.c
onf
# Automatically generated by systemd-insserv-generator

[Unit]
Wants=mail-transport-agent.target
Before=mail-transport-agent.target

The logical assumption would be that the auto-generated service would have
the same commands as "postfix ...".
But I haven't yet figured out how to show/prove whether "postfix reload" =
"systemctl reload postfix"

Michael

Re: reloading postfix with systemd

By Mark Constable at 08/10/2017 - 19:07

On 11/08/17 05:20, Michael Fox wrote:
On *buntu/deb machines it's...

/lib/systemd/system/postfix.service

dpkg -L postfix | grep service

RE: reloading postfix with systemd

By Fazzina, Angelo at 08/10/2017 - 12:42

IMHO

I would think they both work for backwards compatibility and over time
"service postfix reload" will eventually be depreciated and no longer be a valid command.

I expect that to take years.
-ALF

-Angelo Fazzina
Operating Systems Programmer / Analyst
University of Connecticut,  UITS, SSG, Server Systems
860-486-9075

Cc: <a href="mailto:postfix- ... at postfix dot org">postfix- ... at postfix dot org</a>

Am Thu, 10 Aug 2017 10:19:25 -0700
schrieb "Michael Fox" < ... at mefox dot org>:

Well at least in Redhat, if you do systemctl reload postfix it just
executes postfix reload internally. So it makes absolutely no
difference.

# cat /usr/lib/systemd/system/postfix.service
[Unit]
Description=Postfix Mail Transport Agent
After=syslog.target network.target
Conflicts=sendmail.service exim.service

[Service]
Type=forking
PIDFile=/var/spool/postfix/pid/master.pid
EnvironmentFile=-/etc/sysconfig/network
ExecStartPre=-/usr/libexec/postfix/aliasesdb
ExecStartPre=-/usr/libexec/postfix/chroot-update
ExecStart=/usr/sbin/postfix start
ExecReload=/usr/sbin/postfix reload
ExecStop=/usr/sbin/postfix stop

[Install]
WantedBy=multi-user.target

Re: reloading postfix with systemd

By Bastian Blank at 08/10/2017 - 13:06

On Thu, Aug 10, 2017 at 05:42:44PM +0000, Fazzina, Angelo wrote:
Well. "postfix reload" != "service postfix reload".

Bastian

Re: reloading postfix with systemd

By Matus UHLAR - f... at 08/11/2017 - 04:45

On 10.08.17 20:06, Bastian Blank wrote:
are you sure it doesn't just send SIGHUP to master process, with effectively
the same effect than "postfix reload"?