[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to get rid of anacron?



Hello,

On 7/4/22 10:41, Michael wrote:
hey,

afaik systemd timer lack the possibility to send the output (if any) by email to a designated user, but instead logs the output to its journal.

so, if you want/need that functionality, either use a wrapper script, or define a service with an 'ExecStart=' directive looking something like:

ExecStart=/bin/bash -c '/path/to/script/or/executable |& mail -E -r "<from-addr>" -s "<subject>" <user>'

(the -E flag is for /usr/bin/bsd-mailx)

greetings...

yes, you are right. If receiving by mail is a requirement - this works in cron out of the box.


On the other hand the OP did not mentioned mail as a requirement, and in my own case I was not even thinking about receiving the output of the scheduler by mail. For years I was working with cron (/etc/cron.d/*) and crontab and the usage of mail was exclusively a kind-of convenient mean to get instance feedback during the development phase. When the cron entry worked the first line in every cron file under /etc/cron.d/ was MAILTO="". Needed production logs were by some mean put to files by redirection or the cron job called "normal" binaries or scripts that again had some kind of logging.

Using systemd scheduler instant check during development is for my needs sufficiently covered by 'systemctl status' or journalctl.

Best Regards,

Roland



Reply to: