Bug#766756: Does not mail user in case of job errors

Yuri D'Elia wavexx at thregr.org
Sat Oct 25 17:44:22 BST 2014


On 10/25/2014 06:37 PM, Alexandre Detiste wrote:
> 
> We could either:
> 
> *) trigger something with OnFailure=
> http://lists.freedesktop.org/archives/systemd-devel/2014-October/024268.html
> 
> I find this ugly:
> ExecStart=/bin/systemd-cat -t "<MY TIMER JOB LABEL>" /usr/bin/$FOO  whatever

It's ugly indeed. Although using OnFailure would probably be "the
systemd way".

Can't we just call journalctl <> from OnFailure to get the error output?

> *) Use a wrapper
> 
> Environment="MAILTO=xxx at xx.com"
> ExecStart=/usr/lib/systemd-cron/mail_helper /usr/bin/$FOO whatever
> 
> The mail_helper would run the actual program and run mailx if needed
> (either non-empty output or return code <> 0; 
> the tastes vaires)
> 
> Then the static units would need....
> 
> ExecStart=/usr/lib/systemd-cron/mail_helper /bin/run-parts /etc/cron.daily/

Having a wrapper would definitely be the easy way.

Though I would be more inclined to use an OnFailure script instead, if
we can actually manage to get the output from systemd/journalctl.




More information about the Pkg-systemd-maintainers mailing list