[systemd-devel] reboot on emergency.target

Matwey V. Kornilov matwey.kornilov at gmail.com
Thu Apr 9 13:56:59 UTC 2020


вт, 7 апр. 2020 г. в 14:09, Lennart Poettering <lennart at poettering.net>:
>
> On Di, 07.04.20 11:26, Matwey V. Kornilov (matwey.kornilov at gmail.com) wrote:
>
> > Hi,
> >
> > I would like my system to reboot (with some cool down timeout) on
> > emergency.target instead of running the emergency shell. What would be
> > the recommended way to achieve this behavior? Is it ok just to override
> > default emergency.service to whatever I want?
>
> Just override emergency.service in /etc/systemd/system/ with a service
> of your own, that sleeps and then issues "systemctl reboot".
>
> You could also just mask the service and pull in a different service
> instead. Or you could mask it + pull in reboot.target as a dependency
> from emergency.target via a .wants/ symlink (but then you woudln't get
> your cool down timout).

Thank you for the explanation.

However, when I mask emergency.service and add-wants reboot.target,
then emergency.target cannot be isolated anymore:

# systemctl isolate emergency.target
Failed to start emergency.target: Unit emergency.service is masked.


>
> Lennart
>
> --
> Lennart Poettering, Berlin



-- 
With best regards,
Matwey V. Kornilov


More information about the systemd-devel mailing list