啓動sendmail竟然需要很長時間,網上查了查,有很多人碰到類似問題,但是一般都是關掉sendmail服務或者關掉dns了事,咱們現在要用它,自然不能關掉了事,dns也不能關,關了服務器沒法解析域名
毫無疑問,sendmail去做dns lookup,並且無法lookup到域名,在等待解析超時!
這裡我的主機名叫mymachinename,裡面也指定了nameserver,應該能正常做dns解析了,既然他無法解析域名,自然這是個本地域名,難道是hosts裡面的問題,查看了一下hosts文档:
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 192.168.1.28 mymachinename
好像也沒發現啥不對的,他在解析啥呢,看看log去,找到/var/log/maillog(也可能在messages),看到如下内容:
Dec 11 14:25:01 mymachinename sendmail[22710]: starting daemon (8.13.8): SMTP+queueing@01:00:00 Dec 11 14:25:01 mymachinename sm-msp-queue[22717]: My unqualified host name (mymachinename) unknown; sleeping for retry Dec 11 14:28:08 mymachinename sendmail[22803]: My unqualified host name (mymachinename) unknown; sleeping for retry Dec 11 14:35:23 mymachinename sendmail[22944]: My unqualified host name (mymachinename) unknown; sleeping for retry Dec 11 14:35:57 mymachinename sendmail[22962]: My unqualified host name (mymachinename) unknown; sleeping for retry Dec 11 14:36:54 mymachinename sendmail[22979]: My unqualified host name (mymachinename) unknown; sleeping for retry
竟然是無法解析mymachinename,有點意思,直接去ping mymachinename自然是沒問題,突然想到好像FQDN裡面槼定域名必須用”.”結尾,難道是hosts裡面少了一個”.”,嘗試修改hosts文档:
# Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost 192.168.1.28 mymachinename. mymachinename
啓動sendmail,刷一下就啓動了。
回頭想想,問題其實很簡單,但是在網上卻沒找到什麽好的方案,說明都挺嬾的,能繞都繞過去了。