[systemd-devel] safe and fast shutdown/reboot
Lennart Poettering
lennart at poettering.net
Tue Mar 20 11:12:44 UTC 2018
On Fr, 16.03.18 09:13, 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 ?
That is correct. But note that it will also SIGKILL everything else on
the system, including the journal for example, and that means the
journal files will remain in in a dirty state each time (which
journald will deal with, but is not pretty).
> 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
No, for that (as mentioned elsewhere), use KillSignal=SIGKILL or so.
> 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
No. "systemctl reboot --force" means that PID 1 gets replaced by the
"systemd-shutdown" process right away, which has no notion of
services, and will just go on a killing spree and SIGKILL/umount
everything that is left.
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list