Tuesday, January 10, 2012

Hướng dẫn cấu hình crontab not send email

[root@dedi94125 ~]# vi /etc/crontab

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
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

01 01 * * * root /var/qmail/bin/dh_key 2>&1 > /dev/null


Chú ý: nếu muốn không send email thì MAILTO = rỗng

Cách 2:  thêm vào thông số  /dev/null 2>&1

#Before
* * * * * php /path/to/script#After
* * * * * php /path/to/script > /dev/null 2>&1
 
 

No comments: