<div dir="ltr">Hi,
<div>I have a question regarding systemd behavior during shutdown.</div><div><br></div><div>I am using systemd 219 on a Linux 4.1 kernel(custom distribution). When I issue a "shutdown" command I observe something unusual :-</div><div><br></div><div>If a process managed by a systemd unit file with "Restart=always" exits prior to receiving a SIGTERM, systemd attempts to restart the service. However, since the system is shutting down, systemd detects a conflict with shutdown.target, and declares that the service had entered "failed" state. Wouldn't it be cleaner to detect this before attempting to execute the restart job? A service voluntarily exiting during shutdown should not be considered as a failure.<br></div><div><br></div><div>Sample journal logs with detailed output enabled:-</div><div><span style="font-family:monospace,monospace"><br></span></div><div><font size="1" color="#6aa84f" style="background-color:rgb(68,68,68)"><span style="font-family:monospace,monospace">Sep 22 22:59:34 re0 systemd[1]: foo.service holdoff time over, scheduling restart.</span><br></font></div><div><p class="gmail-p1"><span class="gmail-s1" style="background-color:rgb(68,68,68)"><font face="monospace, monospace" size="1" color="#6aa84f">








</font></span></p><p class="gmail-p1"><font face="monospace, monospace" size="1" color="#6aa84f" style="background-color:rgb(68,68,68)"><span class="gmail-s2">33937 </span><span class="gmail-s1">Sep 22 22:59:34 re0 systemd[1]: Trying to enqueue job foo.service/restart/fail</span></font></p><p class="gmail-p1"><span class="gmail-s1" style="background-color:rgb(68,68,68)"><font face="monospace, monospace" size="1" color="#6aa84f">Sep 22 22:59:34 re0 systemd[1]: Requested transaction contradicts existing jobs: Transaction is destructive</font></span></p><p class="gmail-p1"><span style="font-family:monospace,monospace;background-color:rgb(68,68,68)"><font size="1" color="#6aa84f">Sep 22 22:59:34 re0 systemd[1]:foo.service failed to schedule restart job: Transaction is destructive.</font></span></p>
<p class="gmail-p1"><font face="monospace, monospace" size="1" color="#6aa84f"><span class="gmail-s1" style="background-color:rgb(68,68,68)">Sep 22 22:59:34 re0 systemd[1]: foo.service changed auto-restart -> failed</span></font></p></div><div>Thanks,</div><div>Shreyas</div></div>