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

 

這樣就再也不會發郵件了。。。。。。當然也不會有那個錯誤了。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM