Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a crontab task running every 5 minutes. It writes an output (result of the .sh file run by the crontab) to the /var/spool/mail/user. Should I be worried that this spooler will build up and slow down the system over time? Do these entries ever get cleared out? Are they only temporary? If possible, can I disable it.

share|improve this question

migrated from stackoverflow.com Jan 3 '12 at 21:35

This question came from our site for professional and enthusiast programmers.

This is a question about what it takes to program safely on Unix. It is on topic for SO. –  Jonathan Leffler Jan 3 '12 at 20:41
I hope the output written by the crontab task is formatted as a valid e-mail message. If it isn't, you're messing up the user's e-mail inbox. –  Keith Thompson Jan 3 '12 at 21:16

3 Answers 3

The messages stay there until the user whose mail it is reads and deletes the mail. That might be years later (I kid you not!).

  • No, the directory is not cleared out by anything.
  • Yes, you need to be worried about the problem of filling up your disk with unread email.
share|improve this answer
A possible solution might be to forward your mail to some email address that you really are reading. Another would be to redirect in your crontab the stdout & stderr outputs. If they are redirected or empty, crond won't send any email. –  Basile Starynkevitch Jan 3 '12 at 20:50
To send the email to another email address in your crontab edit it and add a line similar to this: MAILTO=user@example.com –  kaptk2 Jan 3 '12 at 22:29

The contents of the /var/spool/mail/user directory remain until the user deletes the mail. You may wish to install a script that runs via cron to remove files older than a certain date, and tweak this as you monitor your system.

share|improve this answer
Don't do this without notifying your users well in advance. I would consider an automated script that deletes my e-mail to be hostile. –  Keith Thompson Jan 3 '12 at 21:17

Well, how can I read the emails? That user is actually me. But it has some default email box on the server. So, how can I read and delete the emails? I'd like to send the emails to an inbox that I actually do read or just delete them from the server....

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.