How to Remove the Note: You have new mail in /var/spool/mail/root

The terminal often prompts you have new mail in/var/spool/mail/root after remote login

This prompt is that Linux will check all kinds of Linux status regularly to make a summary. After a period of time, it will send the summary information to root’s mailbox for viewing when necessary.

Generally, the content of the mail is just some normal system information or more important error reports. If you have installed MUTT, you can directly use this command to view the contents of the mail (log in with root first). If not, you can use cat/var/spool/mail/root (log in with root first).

View content:

[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: <[email protected]&>
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 <root@check1&> /usr/sbin/ntpdate
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <LANG=en_US.UTF-8>
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin&>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=root&>
X-Cron-Env: <USER=root&>
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

You can also set to send this information to the administrator mailbox

Log analysis tool logwatch can analyze the log files of Linux, and automatically send mail to the relevant processing personnel, which can be customized. The mail function of logwatch is to send mail with the help of the mail server of the host system. The system needs to install mail server, such as sendmail, postfix, qmail, etc. the specific configuration is not described

Closing prompt:

[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

Similar Posts: