Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

vixie-cron e-mails me the output of cron jobs, with one message per job.

I would rather receive messages in batches, with either a configurable number of messages per batch or (better) each batch covering a defined time period. I already use logwatch to get daily e-mails; a solution that could be integrated into this system would be ideal.

I can't find a way of configuring vixie-cron (version 4.1-81) to output to a directory or a log file instead of directly to the SMTP client. I am aware that I can manually redirect the output to a different location in crontab itself, but it seems like there should be a way to change the default.

I also wonder what the best tool for sending the e-mails would be (if not logwatch).

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You can tell Cron to send the output to syslog. I believe that cron output will be sent to /var/log/cron on most systems. From here, you can create a logwatch job to scan /var/log/cron and send you the output once per day.

From man 8 cron:

-s

This option will direct cron to send job output to the system log using syslog(3). This is useful if your system has no sendmail(8), or if mail is disabled using -m off.

On some distros, logwatch comes with a logwatch script named 'cron' and a configuration file named 'cron.conf'. See http://www.archlinux.org/packages/community/any/logwatch/files/ for one example. I do not have these files on my RHEL6 system.

share|improve this answer
    
Perfect, thanks. Not sure how I missed the -s option in the man page. –  supervacuo Aug 23 '12 at 17:55

What about settine the email address for a specific cron (MAILTO=mailname, if I recall) where all the mail messages go and have an alias to simply put it into a file. Then process the file as you wish, .... logrotate, or whatever else you want.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.