[systemd-devel] [RFC PATCH] service: add Restart option to execute StartLimitAction immediately
Michael Olbrich
m.olbrich at pengutronix.de
Tue Mar 25 06:42:10 PDT 2014
Hi,
On Mon, Mar 24, 2014 at 08:30:09PM +0100, Lennart Poettering wrote:
> On Thu, 20.03.14 12:52, Michael Olbrich (m.olbrich at pengutronix.de) wrote:
> > The idea is to reboot immediately when a service crashes or the watchdog
> > triggers. This is useful in embedded scenarios when there is only one
> > important service. There are use-cases where rebooting immediately instead
> > of trying to restart the application first makes sense.
> > The environment of the restarted application is not well defined. The
> > watchdog is for unexpected failures. So making sure that the application
> > behaves correctly can be difficult. When rebooting only takes a few
> > seconds, doing so may be more robust than trying to recover from an
> > undefined state.
> >
> > This is an RFC for now. Mostly because I think the configuration is rather
> > awkward like this.
> > Hooking into Restart/StartLimitAction was the easiest way to handle this in
> > the code. But it doesn't feel natural to configure it like this. Any Ideas
> > on how to express this in the unit file?
>
> Sounds useful, but I think it would be better to generalize the "action"
> concept and then expose FailureAction= in addition to
> StartLimitAction=.
So basically in service_enter_dead():
if (s->result != SERVICE_SUCCESS)
execute_failure_action(...);
Right?
Hmmm, that would mean, I need to make sure that my application can never
stop successfully on its own. That's not possible right now, right? I can
redefine failures as success with SuccessExitStatus= but not the other way
around.
Regards,
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the systemd-devel
mailing list