MAIL (mailed 317 bytes of output but got status 0x004b#012)

当Cron执行命令出错时,默认会发送邮件给cron任务的所有者.当然,发送邮件时也可能会出错.我就遇到了如题所示的错误.

我使用的机器环境为Centos7.它默认会使用Postfix来发送邮件.

 

#tail /var/log/cron
Feb 24 16:37:16 iZbp16mm6oot8Z CROND[20862]: (root) MAIL (mailed 317 bytes of output but got status 0x004b#012)
Feb 24 16:37:21 iZbp16mm6oot8Z CROND[20861]: (root) MAIL (mailed 317 bytes of output but got status 0x004b#012)
Feb 24 16:37:26 iZbp16mm6oot8Z CROND[20860]: (root) MAIL (mailed 317 bytes of output but got status 0x004b#012)
Feb 24 16:37:31 iZbp16mm6oot8Z CROND[20859]: (root) MAIL (mailed 317 bytes of output but got status 0x004b#012)
Feb 24 16:37:36 iZbp16mm6oot8Z CROND[20858]: (root) MAIL (mailed 317 bytes of output but got status 0x004b#012)

 

#cat /var/log/maillog

Feb 24 16:36:06 iZbp16mm6oot8Z postfix/sendmail[20327]: fatal: parameter inet_interfaces: no local interface found for ::1
Feb 24 16:36:11 iZbp16mm6oot8Z postfix/sendmail[20386]: fatal: parameter inet_interfaces: no local interface found for ::1
Feb 24 16:36:16 iZbp16mm6oot8Z postfix/sendmail[20434]: fatal: parameter inet_interfaces: no local interface found for ::1
Feb 24 16:36:21 iZbp16mm6oot8Z postfix/sendmail[20481]: fatal: parameter inet_interfaces: no local interface found for ::1
Feb 24 16:36:26 iZbp16mm6oot8Z postfix/sendmail[20534]: fatal: parameter inet_interfaces: no local interface found for ::1
Feb 24 16:36:31 iZbp16mm6oot8Z postfix/sendmail[20570]: fatal: parameter inet_interfaces: no local interface found for ::1
Feb 24 16:36:36 iZbp16mm6oot8Z postfix/sendmail[20614]: fatal: parameter inet_interfaces: no local interface found for ::1
Feb 24 16:36:41 iZbp16mm6oot8Z postfix/sendmail[20660]: fatal: parameter inet_interfaces: no local interface found for ::1
Feb 24 16:36:46 iZbp16mm6oot8Z postfix/sendmail[20711]: fatal: parameter inet_interfaces: no local interface found for ::1


vi /etc/postfix/main.cf

发现配置为:

inet_interfaces = localhost

inet_protocols = all

改成:

inet_interfaces = all

inet_protocols = all


重新启动

service postfix start

==========================================================

这个其实是postfix的配置问题,是计划任务在执行完之后会通过postfix发邮件给执行完的用户邮箱,现在发不出去导致的,修改下配置就行了,但是与本次错误无关。

也可以设置下定时器执行后不发邮件

# crontab -e
MAILTO="" #设置MAILTO参数为空

*/1 * * * * curl http://dr.host.com/cronTab/queryCurrentBill
3 4 * * * curl http://dr.host.com/cronTab/yesterDayOrders


* * * * * curl http://dr.host.com/cronTab/queryLastMonthOrder
* * * * * sleep 5; curl http://dr.host.com/cronTab/queryLastMonthOrder
* * * * * sleep 10; curl http://dr.host.com/cronTab/queryLastMonthOrder
* * * * * sleep 15; curl http://dr.host.com/cronTab/queryLastMonthOrder
* * * * * sleep 20; curl http://dr.host.com/cronTab/queryLastMonthOrder
* * * * * sleep 25; curl http://dr.host.com/cronTab/queryLastMonthOrder

 

这样就再也不会发邮件了。。。。。。当然也不会有那个错误了。

 

posted @   奥雷连诺  阅读(1962)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
点击右上角即可分享
微信分享提示