centos6.6 使用sendmail 备份日志发送邮件

前端之家收集整理的这篇文章主要介绍了centos6.6 使用sendmail 备份日志发送邮件前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

一、环境描述

[root@MysqL-121~]#head-n1/etc/issue
CentOSrelease6.6(Final)
[root@MysqL-121~]#

二、安装步骤

1.安装sendmail服务器

[root@MysqL-121~]#yuminstallsendmail-y
[root@MysqL-121~]#servicesendmailstart
[root@MysqL-121~]#servicesendmailstatus

2.在/etc/mail.rc文件添加发件人的邮箱认证信息

vi/etc/mail.rc
######addbelow#############
setfrom=xxx@163.com
setsmtp=smtp.163.com
setsmtp-auth-user=xxx
setsmtp-auth-password=xxxxx
setsmtp-auth=login

3.邮件发送测试、可以发送到多个邮箱,带附件

echo"Testusingxxx@163.comtosendemail"|mail-a/root/dbbackup.log-s"ThisemailfromLinux"xxxx@139.comxxxx@qq.com

三、问题处理

1.sendmail 启动慢,需要大概3分钟

[root@MysqL-121mail]#servicesendmailstop
Shuttingdownsm-client:[OK]
Shuttingdownsendmail:[OK]
[root@MysqL-121mail]#servicesendmailstart
Startingsendmail:.....卡在这里几分钟

原始配置:

[root@MysqL-121~]#more/etc/hosts
127.0.0.1localhostlocalhost.localdomainlocalhost4localhost4.localdomain4
::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6
127.0.0.1MysqL-121#addedbyApacheFriendsXAMPP
192.168.80.121MysqL-121

修改后配置

vi/etc/hosts
127.0.0.1localhostlocalhost.localdomainMysqL-121
::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain6
127.0.0.1MysqL-121#addedbyApacheFriendsXAMPP
192.168.80.121MysqL-121

重启,秒级别

[root@MysqL-121~]#servicesendmailrestart
Shuttingdownsm-client:[OK]
Shuttingdownsendmail:[OK]
Startingsendmail:[OK]
Startingsm-client:[OK]

2.sendmail和postfix 冲突

[root@MysqL-121~]#servicesendmailstatus
sendmaildeadbutsubsyslocked
sm-client(pid22112)isrunning...

检查postfix服务的状态

[root@MysqL-121~]#servicepostfixstatus
master(pid1777)isrunning...

停止postfix服务

[root@MysqL-121~]#servicepostfixstop
Shuttingdownpostfix:[OK]

重新启动sendmail服务

[root@MysqL-121~]#servicesendmailrestart
Shuttingdownsm-client:[OK]
Shuttingdownsendmail:[OK]
Startingsendmail:[OK]
Startingsm-client:

禁用postfix在reboot后自动启动

[root@MysqL-121~]#chkconfig--list|greppostfix
postfix0:off1:off2:on3:on4:on5:on6:off
[root@MysqL-121~]#chkconfigpostfixoff
[root@MysqL-121~]#chkconfig--list|greppostfix
postfix0:off1:off2:off3:off4:off5:off6:off
[root@MysqL-121~]#
原文链接:/centos/379532.html

猜你在找的CentOS相关文章