1 minute read

My home environment is mostly set to auto-update when new things are available - including my hypervisors. Occasionally, things would restart but my web services and email would be unavailable.

A quick test on my HAProxy reverse proxy showed that HAProxy couldn’t start because a port it expected to listen to was already bound by another service. Another quick check showed that this service was the Postfix MTA which I use to occasionally send status messages and warnings from my servers.

Here’s an area where systemd is nice:
The command systemctl edit <service-name> sets up an override file for the named service. I ran systemctl edit postfix.service and added the following contents to the resulting file:

[Unit]
After=network-online.target haproxy.service

Here I tell systemd to wait for the network to be available and to wait until the HAProxy service has started before attempting to start the Postfix server.

After editing anything related to systemd service files, we also need to tell systemd to refresh itself. This is done with the command systemctl daemon-reload. If it runs without issues we should be good.

Now I just wait to see whether this actually resolved the problem. As it was intermittent I might have to be patient…