Forward cron output to a script

asked 2013-05-20 15:44:02 -0500

lzap gravatar image


by default, cron in fedora delivers failures to root's inbox. I would like to change behavior and pass this into a script. How to do that in Fedora 18+?

If this is not possible, I will have to read mail by a program and pass that to my script, but I would like to do this directly.

edit retag flag offensive close merge delete


Can you elaborate a little? A cron job IS a script, and you can either write your cronjob script to behave in the way you like, or use standard shell redirection in the crontab to redirect to a file.

randomuser gravatar imagerandomuser ( 2013-05-20 21:12:24 -0500 )edit

The thing is for each cronjob installed (e.g. from an RPM package) it stores output od stdout/stderr in the root mail spool folder. I want to change this default behavior and filter this into my own script.

lzap gravatar imagelzap ( 2013-05-21 02:26:35 -0500 )edit

Good question, then :) I think you'll end up parsing your mail.

randomuser gravatar imagerandomuser ( 2013-05-23 17:10:15 -0500 )edit

Yeah, I would like to see OSD bubbles on my laptop rather than some mail dropped in the root folder.

lzap gravatar imagelzap ( 2013-06-26 06:48:01 -0500 )edit

Maybe set a systemd.path unit to watch /var/mail/whatever, and execute a script that pipes mail -H to notify-send? Quick and dirty, but I'm guessing you don't want the full message body in a popup.

randomuser gravatar imagerandomuser ( 2013-06-26 20:33:21 -0500 )edit