虽然已经配置环境变量MAILTO=,
但是 crontab 执行失败后 /var/log/cron 可以查看到具体报错信息,却没有发送mail邮件。
手动测试邮件是否可以正常发送:
1
|
echo
"Your message here"
|
mail
-
s
"Subject"
root
|
提示
1
|
/
usr/
sbin/
sendmail
:
No
such
file
or
directory
|
安装sendmail
1
|
yum
install
sendmail
|
查看/var/log/maillog,报错
1
|
unable
to
qualify
my
own
domain
name
(
)
--
using
short
name
|
修改/etc/hosts,增加对应的主机名
查看/var/log/maillog,报错
1
|
.
0
,
stat=
Deferred
:
Connection
refused
by
[
127.0.0.1
]
|
这种一般是没启动sendmail,启动之后可以正常发送crontab邮件了。