Hints for You have new mail in/var/spool/mail/root on Linux

1. Sometimes we operate under the root user and often prompt you after login: You have new mail in/var/spool/mail/root. This prompt is due to reminde...

1. Sometimes we operate under the root user and often prompt you after login: You have new mail in/var/spool/mail/root.

This prompt is due to reminders sent to root users by the mail mail service on Linux system, which normally turns off reminders or sets mailbox addresses to other mailbox addresses instead of being sent to root users.The solution for this case is to close the prompt directly.

2. Solutions:

Question information:

[root@inotify /]# hostnamectl --transient rsync-inotify You have new mail in /var/spool/mail/root

Step 1: Turn off tips

[root@inotify /]# echo "unset MAILCHECK" >> /etc/profile You have new mail in /var/spool/mail/root [root@inotify /]# source /etc/profile this is oldboy training

Step 2: View the mail service

[root@inotify /]# ls -lth /var/spool/mail/ total 1.3M -rw-------. 1 root mail 1.3M May 21 10:53 root -rw-rw----. 1 oldboy10 mail 0 May 9 15:03 oldboy10 -rw-rw----. 1 oldboy09 mail 0 May 9 15:03 oldboy09 -rw-rw----. 1 oldboy08 mail 0 May 9 15:03 oldboy08 -rw-rw----. 1 oldboy07 mail 0 May 9 15:03 oldboy07 -rw-rw----. 1 oldboy06 mail 0 May 9 15:03 oldboy06 -rw-rw----. 1 oldboy05 mail 0 May 9 15:03 oldboy05 -rw-rw----. 1 oldboy04 mail 0 May 9 15:03 oldboy04 -rw-rw----. 1 oldboy03 mail 0 May 9 15:03 oldboy03 -rw-rw----. 1 oldboy02 mail 0 May 9 15:03 oldboy02 -rw-rw----. 1 oldboy01 mail 0 May 9 15:03 oldboy01 -rw-rw----. 1 rsync mail 0 Apr 28 10:01 rsync -rw-rw----. 1 rep mail 0 Mar 27 22:04 rep -rw-rw----. 1 oldboy mail 0 Mar 27 18:53 oldboy -rw-rw----. 1 mysql mail 0 Mar 27 18:53 mysql

Step 3: Empty the root

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

Step 4: Do it again to see if there are any tips

[root@inotify /]# hostnamectl --static rsync-inotify [root@inotify /]# [root@inotify /]# hostnamectl --transient rsync-inotify [root@inotify /]# hostnamectl set-hostname localhost [root@inotify /]# [root@inotify /]# hostnamectl --static localhost [root@inotify /]#

There was no hint in the last operation, indicating that the mail hint was closed successfully!



7 November 2019, 10:58 | Views: 7084

Add new comment

For adding a comment, please log in
or create account

0 comments