[systemd-devel] systemd default target

Lennart Poettering lennart at poettering.net
Sat Feb 13 10:48:43 UTC 2016


On Fri, 12.02.16 20:58, Pathangi Janardhanan (path.jana at gmail.com) wrote:

> Hi All,
> 
>  The default target is usually set to multi-user or someother equivalent
> target. Is there any way in systemd that I can say something like
> 
> " If the system is reloaded n number of times within the last x second",
> than set the default target to recover or emergency mode etc.?
> 
>  Basically I am looking for recovering from a failing unit/service that is
> forcing the system to reboot, and that is going in a cycle?

You may configure whether a unit shall be automatically restarted with
Restart=on-failure. You may put a limit on it with StartLimitInterval=
and StartLimitBurst=. You may configure what shall happen if the limit
is hit with StartLimitAction=, which includes making the system reboot.

See the systemd.service and systemd.unit man pages.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list