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

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

一、环境描述

1
2
3
[root@mysql-121 ~] # head -n1 /etc/issue
CentOS release 6.6 (Final)
[root@mysql-121 ~] #

二、安装步骤

1.安装sendmail服务器

1
2
3
[root@mysql-121 ~] # yum install sendmail -y
[root@mysql-121 ~] # service sendmail start
[root@mysql-121 ~] # service sendmail status

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

1
2
3
4
5
6
7
vi  /etc/mail .rc
######add below############# 
set  from=xxx@163.com
set  smtp=smtp.163.com
set  smtp-auth-user=xxx
set  smtp-auth-password=xxxxx
set  smtp-auth=login

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

1
echo  "Test using xxx@163.com  to send email "  | mail -a  /root/dbbackup .log -s  "This email from Linux"  xxxx@139.com xxxx@qq.com

三、问题处理

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

1
2
3
4
5
[root@mysql-121 mail] # service sendmail stop
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
[root@mysql-121 mail] # service sendmail start
Starting sendmail:    .....卡在这里几分钟

原始配置:

1
2
3
4
5
[root@mysql-121 ~] # 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

修改后配置

1
2
3
4
5
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

重启,秒级别

1
2
3
4
5
[root@mysql-121 ~] # service sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:                                        [  OK  ]

2.sendmail和postfix 冲突

1
2
3
[root@mysql-121 ~] # service sendmail status
sendmail dead but subsys locked
sm-client (pid  22112) is running...

检查postfix服务的状态

1
2
[root@mysql-121 ~] #service postfix status
master (pid  1777) is running...

停止postfix服务

1
2
[root@mysql-121 ~] #service postfix stop
Shutting down postfix: [  OK  ]

重新启动sendmail服务

1
2
3
4
5
[root@mysql-121 ~] # service sendmail restart
Shutting down sm-client:                                   [  OK  ]
Shutting down sendmail:                                    [  OK  ]
Starting sendmail:                                         [  OK  ]
Starting sm-client:

禁用postfix在reboot后自动启动

1
2
3
4
5
6
[root@mysql-121 ~] # chkconfig --list |grep postfix
postfix         0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@mysql-121 ~] # chkconfig postfix off
[root@mysql-121 ~] # chkconfig --list|grep postfix
postfix         0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@mysql-121 ~] #










本文转自 roidba 51CTO博客,原文链接:http://blog.51cto.com/roidba/1880841,如需转载请自行联系原作者
相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
目录
相关文章
|
1月前
|
Linux 应用服务中间件 nginx
【PUSDN】centos查看日志文件内容,包含某个关键字的前后5行日志内容,centos查看日志的几种方法
【PUSDN】centos查看日志文件内容,包含某个关键字的前后5行日志内容,centos查看日志的几种方法
49 0
|
4月前
|
Kubernetes Shell Linux
linux|shell脚本|有趣的知识---格式化输出日志和脚本调试方法以及kubernetes集群核心服务重启和集群证书备份脚本
linux|shell脚本|有趣的知识---格式化输出日志和脚本调试方法以及kubernetes集群核心服务重启和集群证书备份脚本
62 0
|
17天前
|
网络协议 应用服务中间件 Linux
centos7 Nginx Log日志统计分析 常用命令
centos7 Nginx Log日志统计分析 常用命令
33 2
|
5月前
|
存储 关系型数据库 MySQL
CentOS7+Rsyslog+MySQL 搭建 Rsyslog 日志服务器
CentOS7+Rsyslog+MySQL 搭建 Rsyslog 日志服务器
131 0
|
2月前
|
SQL 关系型数据库 MySQL
MySQL技能完整学习列表11、日志和备份——1、查看日志——2、数据备份和恢复(mysqldump, mysqlbinlog)
MySQL技能完整学习列表11、日志和备份——1、查看日志——2、数据备份和恢复(mysqldump, mysqlbinlog)
45 0
|
2月前
|
SQL 关系型数据库 MySQL
centos实现mysql定时备份(单机)
centos实现mysql定时备份(单机)
75 0
|
3月前
|
Linux Shell
开源日志平台GrayLog5.1.10 CentOS7一键安装脚本
开源日志平台GrayLog5.1.10 CentOS7一键安装脚本
101 0
|
3月前
|
Linux
开源日志平台GrayLog5.1.7 CentOS7一键安装脚本
开源日志平台GrayLog5.1.7 CentOS7一键安装脚本
82 1
|
3月前
|
存储 数据库
HBR混合云备份中,累计增量备份和日志备份
【1月更文挑战第3天】【1月更文挑战第15篇】 HBR混合云备份中,累计增量备份和日志备份
31 1
|
4月前
|
Linux
百度搜索:蓝易云【centos系统应用日志文件被删,空间无法释放怎么办】
通过以上方法,你应该能够解决应用日志文件被删除但空间无法释放的问题,并恢复磁盘空间。
31 1

热门文章

最新文章