I want to clear the Linux mail for my account every day at 10pm. How can I accomplish it?
Asked
Active
Viewed 1,092 times
-1
1 Answers
2
You could crontab -e
to edit your personal list of cron jobs, and add the line:
0 22 * * * : > /var/mail/"$(whoami)"
which will, at 22:00 (10pm) every day, overwrite the file /var/mail/<your username>
with empty data. If your mail file is stored somewhere else, you would need to change the path.
-
1It's better to use
: > /var/mail/"$(whoami)"
as not all shells support empty redirection. – heemayl Sep 26 '16 at 21:13
man
page makes you think you can schedule things withmail
? – Anthon Sep 27 '16 at 07:01