<div dir="ltr"><div>Hmm. This is probably not ideal, but you could hook a 'Type=oneshot' service into shutdown.target which runs 'systemctl kill {your service}.service'.<br><br></div>I'm not sure if there's a simpler way to do this using targets.<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Mar 15, 2018 at 8:57 PM prashantkumar dhotre <<a href="mailto:prashantkumardhotre@gmail.com">prashantkumardhotre@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks but I want to sigkill my services only during system shutdown and not on normal service stop 'systemctl myservice stop'.<div>so I can not use '
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.8px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">KillSignal' setting. Is there any other way ?</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 16, 2018 at 9:23 AM, Zeal Jagannatha <span dir="ltr"><<a href="mailto:zealjagannatha@gmail.com" target="_blank">zealjagannatha@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I think it would be better for the services you define to specifically define their own `KillSignal` so you can control how they shutdown.<br><a href="https://www.freedesktop.org/software/systemd/man/systemd.kill.html#KillSignal=" target="_blank">https://www.freedesktop.org/software/systemd/man/systemd.kill.html#KillSignal=</a><br></div><div><br></div>It's may not be safe for all the services on the machine to be shut down with SIGKILL, so you should avoid using '--force' unless you know that everything running on the system is safe to shutdown with SIGKILL.<br></div><br><div class="gmail_quote"><div><div class="m_5248824917025673454h5"><div dir="ltr">On Thu, Mar 15, 2018 at 8:43 PM prashantkumar dhotre <<a href="mailto:prashantkumardhotre@gmail.com" target="_blank">prashantkumardhotre@gmail.com</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_5248824917025673454h5"><div dir="ltr">Hi<div>I see that default reboot/systemctl reboot command issues SIGTERM to my apps and hence it is doing graceful stop of apps and this may take some time and hence shutdown time may be little longer.<br></div><div>
<div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial"><br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-style:initial;text-decoration-color:initial">I am looking for safe and fastest shutdown/reboot method.</div><br class="m_5248824917025673454m_-6790504361302708252m_6286953044956898218gmail-Apple-interchange-newline">
<br></div><div>a) It is OK if my apps are stopped ungracefully during shutdown .(app should not start automatically again after they are killed/stopped during shutdown)</div><div><br></div><div>b) file system and such system level stuff needs to be cleanly shut down</div><div><br></div><div>1) From my research, I see that 'systemctl reboot --force' is the one I can use.</div><div>I understand that this command sends SIGKILL to my apps.</div><div>So this satisfies both (a) and (b) and hence this command should be used to reboot faster.</div><div>Could you please confirm ? <br></div><div>If this is not right method, please comment on which method to use.</div><div><br></div><div>2) Also is there a way to limit SIGKILL to only my apps when I do '
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">'systemctl reboot --force'</span></div><div>so that rest of the system level services still get stopped gracefully</div><div><br></div><div>3) If
<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">'systemctl reboot --force'<span> is correct command to use in my case, then during shutdown , will my apps get restarted </span></span></div><div><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span>due to '</span></span>Restart'/'StartLimitBurst'/'StartLimitInterval' settings in service file ? I dont want my apps to get restarted if they are stopped/killed during system shutdown</div><div><br></div><div><br></div><div>Thanks</div><div><br></div><div><br></div><div><br></div></div></div></div>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank">systemd-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a><br>
</blockquote></div>
</blockquote></div><br></div>
</blockquote></div>