[systemd-devel] systemd-cron: retrigger generator after /var is mounted

"Jóhann B. Guðmundsson" johannbg at gmail.com
Wed Oct 22 05:13:05 PDT 2014


On 10/22/2014 11:26 AM, Alexandre Detiste wrote:
> it just doesn't send emails like cron; but that will remain an wontfix I guess.

Systemd itself does not send email but you can configure the timer units 
( the service part ) to do so when they fail via OnFailure=<trigger 
custom email script> but you have to do so individually per timer's 
service units ( you cannot define that Onfailure= behaviour default for 
all units or just timer units ) .

That takes care of failed starting timer jobs which is how I'm accustom 
to receive notifications from cron
( there seems to be split in practical sense of this as in those that 
only want to get email when things fail to run and those that always 
want to get email regardless if they failed to run or not )

The always part you handle in the script being run or via another Exec* line

I would recommend you to label the timer in the journal as well for 
quick searching only for relevant timer info

ExecStart=/bin/systemd-cat -t "<MY TIMER JOB LABEL>" /usr/bin/$FOO  whatever

Then run ( or script for email ) something like

journalctl SYSLOG_IDENTIFIER=<MY TIMER JOB LABEL>

Which will output you just the info you need.

Arguable we should always label timer units in the journal which in turn 
would take care of that usability bug where users complain about timers 
being to noisy in log  but Lennart can comment on that if he considers 
that viable solution for that "bug".

JBG


More information about the systemd-devel mailing list