cron用什么邮件发送邮件?

我试图debugging一个问题,没有发送邮件在Centos 6框,我没有configuration。 我怎样才能确定哪个邮件程序正在使用发送邮件? crontab手册页有这样的说:

除了LOGNAME,HOME和SHELL之外,cron(8)还会查看MAILTO是否有任何理由通过运行“this”crontab中的命令来发送邮件。 如果MAILTO被定义(并且非空),则邮件被发送给如此命名的用户。 如果MAILTO被定义但为空(MAILTO =“”),则不会发送邮件。 否则,邮件将发送给crontab的所有者。 如果您安装cron – / bin / mail不会执行别名,并且UUCP通常不读取其邮件,则此选项非常有用,如果您决定使用/ bin / mail而不是/ usr / lib / sendmail作为邮件程序。

带星号的部分是让我疑惑的部分:“是sendmail还是邮件?”

一个快速的Google显示, /etc/sysconfig/crond是定义cron使用什么邮件程序的文件。

根据cron(8)的手册页(实际发送消息的守护进程):

  -m This option allows you to specify a shell command string to use for sending cron mail output instead of sendmail(8). This command must accept a fully formatted mail message (with headers) on stdin and send it as a mail message to the recipients specified in the mail headers. 

这使我相信,它默认使用sendmail。 让我们用stracevalidation:

设置将生成电子邮件的cron作业:

 user@host1 ~: $ crontab -e crontab: installing new crontab user@host1 ~: $ crontab -l [email protected] */5 * * * * echo "testing" 

现在findcrond的进程ID:

 user@host1 ~: $ ps auxww | grep crond root 9684 0.0 0.0 117280 1296 ? Ss Jul22 0:17 crond user 36344 0.0 0.0 103240 884 pts/2 S+ 23:01 0:00 grep crond 

使用strace附加到crond进程,寻找与进程相关的活动。 正如strace写到stderr我已经redirect到标准输出并grepped'邮件':

 root@host1 ~: # strace -fp 9684 -s 1024 -e trace=process 2>&1 | grep mail [pid 36204] execve("/usr/sbin/sendmail", ["/usr/sbin/sendmail", "-FCronDaemon", "-i", "-odi", "-oem", "-oi", "-t", "-f", "root"], [/* 16 vars */]) = 0 ^C 

是的,这是sendmail。