問題背景:
centos執(zhí)行命令的時候,不知道怎么就突然出現(xiàn)的“您在 /var/spool/mail/root 中有郵件” 這東西還是比較煩人……
解決:
第一種方法 關(guān)閉linux系統(tǒng)的郵件功能自動提示:(我用的這個~)
echo "unset MAILCHECK">> /etc/profile
source /etc/profile
修改 /etc/profile 會提示:需要權(quán)限,使用sudo可能還是會提醒沒有權(quán)限(我的就是)
切換到root用戶:
su
回到用戶權(quán)限:
exit
第二種方法 用logWatch轉(zhuǎn)發(fā)郵件
vi /usr/share/logwatch/default.conf/logwatch.conf
MailTo = yourmail@xx.com
?彩蛋:如果你對mail命令感興趣可以試著簡單玩一下~~~下面有參考地址噢~
查看你有多少郵件未讀
mail
刪除第幾行到第幾行
d 1-10
退出查看
q
清空郵件
cat /dev/null > /var/spool/mail/root
?感謝以下地址:
【解決Centos關(guān)閉You have new mail in /var/spool/mail/root提示(轉(zhuǎn))
】
https://www.cnblogs.com/zhangmingcheng/p/6275413.html
【linux mail命令用法】
https://blog.csdn.net/youmatterhsp/article/details/80207914
【linux下 如何切換到root用戶】
https://www.cnblogs.com/xinjie10001/p/6295020.html
【解決“您在 /var/spool/mail/root 中有郵件”的問題】
http://www.itdecent.cn/p/88df3d13f29d