safe and fast shutdown/reboot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



One other thing that may work, is that you could implement a ExecStop
action in your service unit, that checks if the system is been shutting
down (by checking status of {shutdown,reboot,halt}.target [or maybe also
the runlevel may work?]), and kill the unit if there is one of those
operations.


Alvaro Leiva

On Thu, Mar 15, 2018 at 9:14 PM, Zeal Jagannatha <zealjagannatha at gmail.com>
wrote:

> 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
>>>>
>>>
>>
> _______________________________________________
> 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/20180315/175d2370/attachment.html>


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux