[systemd-devel] safe and fast shutdown/reboot

Zeal Jagannatha zealjagannatha at gmail.com
Fri Mar 16 04:14:05 UTC 2018


Hmm. This is probably not ideal, but you could hook a 'Type=oneshot'
service into shutdown.target which runs 'systemctl kill {your
service}.service'.

I'm not sure if there's a simpler way to do this using targets.

On Thu, Mar 15, 2018 at 8:57 PM prashantkumar dhotre <
prashantkumardhotre at gmail.com> wrote:

> Thanks but I want to sigkill my services only during system shutdown and
> not on normal service stop 'systemctl myservice stop'.
> so I can not use ' KillSignal' setting. Is there any other way ?
>
> On Fri, Mar 16, 2018 at 9:23 AM, Zeal Jagannatha <zealjagannatha at gmail.com
> > wrote:
>
>> I think it would be better for the services you define to specifically
>> define their own `KillSignal` so you can control how they shutdown.
>>
>> https://www.freedesktop.org/software/systemd/man/systemd.kill.html#KillSignal=
>>
>> 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.
>>
>> On Thu, Mar 15, 2018 at 8:43 PM prashantkumar dhotre <
>> prashantkumardhotre at gmail.com> wrote:
>>
>>> Hi
>>> 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.
>>>
>>> I am looking for safe and fastest shutdown/reboot method.
>>>
>>>
>>> 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)
>>>
>>> b)  file system and such system level stuff needs to be cleanly shut down
>>>
>>> 1) From my research, I see that 'systemctl reboot --force' is the one I
>>> can use.
>>> I understand that this command sends SIGKILL to my apps.
>>> So this satisfies both (a) and (b) and hence this command should be used
>>> to reboot faster.
>>> Could you please confirm ?
>>> If this is not right method, please comment on which method to use.
>>>
>>> 2) Also is there a way to limit SIGKILL to only my apps when I do ' 'systemctl
>>> reboot --force'
>>> so that rest of the system level services still get stopped gracefully
>>>
>>> 3) If  'systemctl reboot --force' is correct command to use in my case,
>>> then during shutdown , will my apps get restarted
>>> due to 'Restart'/'StartLimitBurst'/'StartLimitInterval' settings in
>>> service file ? I dont want my apps to get restarted if they are
>>> stopped/killed during system shutdown
>>>
>>>
>>> Thanks
>>>
>>>
>>>
>>> _______________________________________________
>>> systemd-devel mailing list
>>> systemd-devel at lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180316/ce565413/attachment.html>


More information about the systemd-devel mailing list