Last modified by Alexandru Pentilescu on 2025/02/09 14:17

From version 14.1
edited by Alexandru Pentilescu
on 2024/07/15 21:44
Change comment: There is no comment for this version
To version 15.1
edited by Alexandru Pentilescu
on 2025/02/09 14:17
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -190,16 +190,22 @@
190 190  {{code language="Systemd"}}
191 191  [Unit]
192 192  Description=Postfix Mail Transport Agent
193 -Conflicts=sendmail.service exim4.service
194 -ConditionPathExists=/etc/postfix/main.cf
193 +After=network-online.target docker.service
194 +Wants=network-online.target
195 195  
196 196  [Service]
197 -Type=oneshot
198 -RemainAfterExit=yes
199 -ExecStart=/bin/true
200 -ExecReload=/bin/true
201 -Restart=on-failure
202 -RestartSec=1s
197 +Type=forking
198 +ExecStart=/usr/sbin/postfix start
199 +ExecStop=/usr/sbin/postfix stop
200 +ExecReload=/usr/sbin/postfix reload
201 +Restart=always
202 +RestartSec=5s
203 +ExecStartPre=/bin/sleep 10
204 +PIDFile=/var/spool/postfix/pid/master.pid
205 +
206 +[Install]
207 +WantedBy=multi-user.target
208 +
203 203  {{/code}}
204 204  
205 205  From that, the only genuinely relevant changes that need to be highlighted are the last two lines (i.e. the "Restart" and "RestartSec" assignments). These tell systemd that that, in the event that the service gets killed due to an abnormality (i.e. it receives a SIGKILL system because it is running low on RAM), to automatically restart it. The second rule (i.e. "RestartSec"), tells it to wait an entire second before performing the restart, so that it gives the system the chance to finish whatever it was doing.