Linux出现You have new mail in /var/spool/mail/root提示,关闭邮件提示的解决方案

有的时候敲一下回车,就出来You have new mail in /var/spool/mail/root的提示。
原因是Linux系统经常会自动发出一些邮件来提醒用户系统中出了哪些问题(收件箱位置:/var/mail/),比如crontab里面的脚本命令执行错误了(sh文件名,python命令没有使用全路径,没有使用后台运行nohup命令等问题导致无法正常执行的报错)。
LINUX会定时查看各种状态做汇总,每经过一段时间会把汇总的信息发送到root的邮箱里。
一般这种情况mail的内容就只是一些正常的系统信息或者是比较重要的错误报告。

centos默认安装有sendmail的,可以使用mail命令查询(要退出时输入q加回车)

如果安装了mutt可以用mutt命令查看mail的内容,没有装用系统命令:cat /var/spool/mail/root查看。

----------------

要关闭提示的解决方案:
第一步:关闭提示
echo "unset MAILCHECK">> /etc/profile
source /etc/profile
第二步:查看
ls -lth /var/spool/mail/
第三步:清空
cat /dev/null > /var/spool/mail/root 这个方法只能清理掉cat  /var/spool/mail/root 命令查看的内容

echo '' > /var/spool/mail/root  这个方法才能清理掉mail命令查看的内容

---------------------
实战示例:
# echo "unset MAILCHECK">> /etc/profile
# source /etc/profile
# ls -lth /var/spool/mail/
total 144K
-rw------- 1 root mail 139K Nov 26 04:08 root
-rw-rw----. 1 rpc mail 0 Aug 8 2018 rpc
# cat /dev/null > /var/spool/mail/root
# cat /var/spool/mail/root
再查看内容为空了

====================
root邮件转发到自己的邮箱
方法一:
修改此文件
vi /etc/log.d/logwatch.conf
添加MailTo = root,xxx@xxx.com

方法二
vi /etc/aliases
添加root: xxx@xxx.com

Linux出现You have new mail in /var/spool/mail/root提示,关闭邮件提示清理内容的解决方案的更多相关文章

  1. Linux关闭You have new mail in /var/spool/mail/root提示

    终端远程登陆Linux后经常提示You have new mail in /var/spool/mail/root 这个提示是LINUX会定时查看LINUX各种状态做汇总,每经过一段时间会把汇总的信息 ...

  2. 解决Centos关闭You have new mail in /var/spool/mail/root提示

    昨天搬到阿里云了. 装的系统是Centos 6.3的加固版 今天查看内存的时候 出现一天奇怪的提示 You have new mail in /var/spool/mail/root 有的时候每敲一下 ...

  3. You have new mail in /var/spool/mail/root 解决烦琐提示的方法

    今天写定时任务时,出现奇怪的提示,有的时候每敲一下回车,也出现奇怪的提示 You have new mail in /var/spool/mail/root 阿西吧........表示很烦...究竟是 ...

  4. 解决Centos关闭You have new mail in /var/spool/mail/root提示(转)

    今天查看内存的时候 出现一天奇怪的提示 You have new mail in /var/spool/mail/root 有的时候每敲一下回车,就出来You have new mail in /va ...

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

    终端远程登陆后经常提示You have new mail in /var/spool/mail/root 这个提示是LINUX会定时查看LINUX各种状态做汇总,每经过一段时间会把汇总的信息发送的ro ...

  6. You have new mail in /var/spool/mail/root 烦不烦你(转)

    转自(http://blog.csdn.net/yx_l128125/article/details/7425182) 有时在进入系统的时候经常提示You have new mail in /var/ ...

  7. You have new mail in /var/spool/mail/root消除提示的方法

    有时在进入系统的时候经常提示You have new mail in /var/spool/mail/root 你觉得烦人---解决方法: 修改系统配置文件/etc/profile,告诉系统不要去检查 ...

  8. 禁止Centos系统You have new mail in /var/spool/mail/root提示

    禁止Centos系统You have new mail in /var/spool/mail/root提示 https://blog.csdn.net/oyym_mv/article/details/ ...

  9. you have new mail in /var/spool/mail/root !

    今天开发的同事告诉我,他在登录系统时老是提示you have new mail in /var/spool/mail/root ! 我一猜就知道他们肯定又自己写定时任务了,这样的事已经发生过好几回了, ...

随机推荐

  1. kali linux maltego-情报收集工具

    Maltego是一个交互式数据挖掘工具,它为链接分析呈现有向图.该工具用于在线调查,以发现互联网上各种来源的信息片段之间的关系. 注册Maltego账号,注册地址:https://www.paterv ...

  2. 一文解读ARM架构 (转)

    本文主要介绍的是arm架构和x86架构的区别,首先介绍了ARM架构图,其次介绍了x86架构图,最后从性能.扩展能力.操作系统的兼容性.软件开发的方便性及可使用工具的多样性及功耗这五个方面详细的对比了a ...

  3. [转]JVM系列一:JVM内存组成及分配

    原文地址:http://www.cnblogs.com/redcreen/archive/2011/05/04/2036387.html JVM系列一:JVM内存组成及分配 java内存组成介绍:堆( ...

  4. ms sql事务输出错误

    begin try 语句 end trybegin catch --ERROR_NUMBER() 返回错误号. --ERROR_SEVERITY() 返回严重性. --ERROR_STATE() 返回 ...

  5. 使用Urllib下载图片

    urllib下载图片 urllib3下载图片 Urllib下载图片 from urllib import request import re import os # 妹子图首页 下载首页的几张 url ...

  6. nginx是怎么处理http请求的

    nginx是怎么处理http请求的 参考:How nginx processes a request nginx first decides which server should process t ...

  7. spring框架开发包官网各版本的下载地址

    链接地址https://spring.io/tools3/sts/legacy,推荐迅雷下载

  8. 【HDU1814】Peaceful Commission(2-sat+暴力染色)

    传送门 \(2-sat\)的模板题,首先得出题目中的二元关系为:对于有矛盾的\(x_i,x_j\),至多选择一个,那么连边\(x_i\rightarrow x_j',x_j\rightarrow x_ ...

  9. SQL必知必会|SQL基础篇

    了解SQL DBMS的前世今生 SQL是如何执行的 DDL语法 关于外键的性能问题? 是否使用外键确实会有一些争议.关于外键的使用: 首先,外键本身是为了实现强一致性,所以如果需要正确性>性能的 ...

  10. SCOI 2005 互不侵犯

    洛谷 P1896 [SCOI2005]互不侵犯 洛谷传送门 题目描述 在N×N的棋盘里面放K个国王,使他们互不攻击,共有多少种摆放方案.国王能攻击到它上下左右,以及左上左下右上右下八个方向上附近的各一 ...