[systemd-devel] systemd restart patch
Lennart Poettering
lennart at poettering.net
Tue Feb 8 02:23:08 PST 2011
On Thu, 03.02.11 22:19, Michael Biebl (mbiebl at gmail.com) wrote:
>
> 2011/2/3 Tomasz Torcz <tomek at pipebreaker.pl>:
> > On Thu, Feb 03, 2011 at 09:35:55PM +0100, Michael Biebl wrote:
> >> ExecStartOnFailure=/some/cmd (send an email or what not)
> >
> > Isn't “OnFailure=send-email-to-admin.service” sufficent?
>
> Having to use a service file for this use case is imho cumbersome,
Well, I think it could actually have benefits too, since this way you
can use the same failure handler for a number of services.
> especially since you can't pass information to that service afaik,
> e.g. via env variables.
Well, you actually can. You can do "OnFailure=failhandler@%n.service"
which then passes along the service name of the service that caused the
failure. The failure handler could then use dbus (or systemctl status)
to figure out what to do and what happened.
> So this send-email-to-admin.service doesn't know which service it was,
> that failed and its last status code. Or am I misinformed here?
>
> Also, does OnFailure= work as I described with regard to Restart=on-failure?
No, it currently doesn't.
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list