[CentOS] centos 6.3, cron and mail script output

Banyan He banyan at rootong.com
Fri Nov 23 08:28:51 UTC 2012


check out the crontab file if you have these,

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root ===========================> that's what you are looking for
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

------------
Banyan He
Blog: http://www.rootong.com
Email: banyan at rootong.com

On 2012-11-23 3:52 PM, Mihamina Rakotomandimby wrote:
> Hi all
>
> I have a '/etc/cron.daily/push-to-backup' script which the content is:
>
>     #!/bin/bash
>     /usr/bin/rsync [... long options line ...]
>     echo "finished pushing to the backup"
>
> Launched manually, it's OK.
>
> Waiting for cron to execute it,
> In the "/var/log/cron", I see the starting time and the finish time, and
> I see it take about 10 minutes to make the job. That's very fine, it's
> the expected executioon time
>
> The problem is: I get no EMail.
> In "/etc/cron.daily/", I also have "logwatch", whose EMail comes to me
> without problem.
> "/etc/aliases" is already setup to forward root and cron emails to my
> email adress.
> Testing the MTA (Exim) on command-line: success (anyway, logwatch also
> success on sending email)
>
>
> On another centos5 machine, the same script, the mail is sent.
>
> On the Centos 6:
>     $ rpm -aq | grep cron
>     crontabs-1.10-33.el6.noarch
>     cronie-1.4.4-7.el6.x86_64
>     cronie-anacron-1.4.4-7.el6.x86_64
>
> On the Centos 5:
>     $ rpm -aq | grep cron
>     crontabs-1.10-8
>     vixie-cron-4.1-81.el5
>     anacron-2.3-45.el5.centos
>
>
> How to setup the Centos6 system so that the cron sends me an email the
> script output??
>



More information about the CentOS mailing list