centos6.6 使用sendmail 备份日志发送邮件
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos6.6 使用sendmail 备份日志发送邮件相关的知识,希望对你有一定的参考价值。
一、环境描述
[[email protected] ~]# head -n1 /etc/issue CentOS release 6.6 (Final) [[email protected] ~]#
二、安装步骤
1.安装sendmail服务器
[[email protected] ~]# yum install sendmail -y [[email protected] ~]# service sendmail start [[email protected] ~]# service sendmail status
2.在/etc/mail.rc文件中添加发件人的邮箱认证信息
vi /etc/mail.rc ######add below############# set [email protected] set smtp=smtp.163.com set smtp-auth-user=xxx set smtp-auth-password=xxxxx set smtp-auth=login
3.邮件发送测试、可以发送到多个邮箱,带附件
echo "Test using [email protected] to send email " | mail -a /root/dbbackup.log -s "This email from Linux" [email protected] [email protected]
三、问题处理
1.sendmail 启动慢,需要大概3分钟
[[email protected] mail]# service sendmail stop Shutting down sm-client: [ OK ] Shutting down sendmail: [ OK ] [[email protected] mail]# service sendmail start Starting sendmail: .....卡在这里几分钟
原始配置:
[[email protected] ~]# more /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 127.0.0.1 mysql-121 # added by Apache Friends XAMPP 192.168.80.121 mysql-121
修改后配置
vi /etc/hosts 127.0.0.1 localhost localhost.localdomain mysql-121 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 127.0.0.1 mysql-121 # added by Apache Friends XAMPP 192.168.80.121 mysql-121
重启,秒级别
[[email protected] ~]# service sendmail restart Shutting down sm-client: [ OK ] Shutting down sendmail: [ OK ] Starting sendmail: [ OK ] Starting sm-client: [ OK ]
2.sendmail和postfix 冲突
[[email protected] ~]# service sendmail status sendmail dead but subsys locked sm-client (pid 22112) is running...
检查postfix服务的状态
[[email protected] ~]#service postfix status master (pid 1777) is running...
停止postfix服务
[[email protected] ~]#service postfix stop Shutting down postfix: [ OK ]
重新启动sendmail服务
[[email protected] ~]# service sendmail restart Shutting down sm-client: [ OK ] Shutting down sendmail: [ OK ] Starting sendmail: [ OK ] Starting sm-client:
禁用postfix在reboot后自动启动
[[email protected] ~]# chkconfig --list |grep postfix postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off [[email protected] ~]# chkconfig postfix off [[email protected] ~]# chkconfig --list|grep postfix postfix 0:off 1:off 2:off 3:off 4:off 5:off 6:off [[email protected] ~]#
以上是关于centos6.6 使用sendmail 备份日志发送邮件的主要内容,如果未能解决你的问题,请参考以下文章