解决You have new mail in /var/spool/mail/root提示

终端远程登陆后经常提示You have new mail in /var/spool/mail/root

这个提示是LINUX会定时查看LINUX各种状态做汇总,每经过一段时间会把汇总的信息发送的root的邮箱里,以供有需之时查看。

一般这种情况mail的内容就只是一些正常的系统信息或者是比较重要的错误报告。如果你安装了mutt的话直接用这个命令就可以查看mail的内容(用root登陆先),没有装的话用

# cat /var/spool/mail/root

查看(用root登陆先)。

查看内容:

[root@check1 ~]# cat /var/spool/mail/root
 
24 May 01:03:01 ntpdate[24397]: the NTP socket is in use, exiting
 
From [email protected] Thu May 24 01:04:01 2018
Return-Path: 
X-Original-To: root
Delivered-To: [email protected]
Received: by check1.localdomain (Postfix, from userid 0)
id 5C6D2C0BB7; Thu, 24 May 2018 01:04:01 +0800 (CST)
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron  /usr/sbin/ntpdate 202.112.31.197
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: 
X-Cron-Env: 
X-Cron-Env: 
X-Cron-Env: 
X-Cron-Env: 
X-Cron-Env: 
X-Cron-Env: 
Message-Id: <[email protected]>
Date: Thu, 24 May 2018 01:04:01 +0800 (CST)
 
24 May 01:04:01 ntpdate[24552]: the NTP socket is in use, exiting

也可以设置把这个信息发送到管理员邮箱

日志分析工具 Logwatch能够对Linux 的日志文件进行分析,并自动发送mail给相关处理人员,可定制需求 Logwatch的mail功能是借助宿主系统自带的mail server发邮件的,系统需安装mail server , 如sendmail,postfix,Qmail等,具体配置不叙述

关闭提示:

[root@check1 ~]# echo "unset MAILCHECK">> /etc/profile
[root@check1 ~]# source /etc/profile

查看:

[root@check1 ~]# ls -lth /var/spool/mail/
total 49M
-rw------- 1 root mail 49M Jul 4 13:43 root
-rw-rw---- 1 nginx mail 0 May 21 11:46 nginx
-rw-rw---- 1 zabbix mail 0 May 16 15:48 zabbix

清空:

[root@check1 ~]# cat /dev/null > /var/spool/mail/root

你可能感兴趣的:(解决You have new mail in /var/spool/mail/root提示)