The size of /var/mail/root has been increasing as i am using lot of cron jobs and may cause memory shortage.

Is it wise to delete that file? How to manage this problem?


You should handle these kind of issues with logrotate, it is designed for these tasks specifically.

For example, to enable logrotate to rotate the file /var/mail/root if the size of the file becomes 10 MB, you can add a logrotate configuration file e.g. /etc/logrotate.d/mailroot with the content:

/var/mail/root {
        size 10M  # Rotate if the size is >=10MB
        rotate 5  # Keep 5 rotated logs
        notifempty # Do not rotate if empty
        compress  # Compresses rotated logs, default

You can define for the whole directory too using wildcard, *, so that it will be applicable to all files under it:

/var/mail/* {



As logrotate is run daily by cron (anacron), you do not need to add any cron entry if the configuration is put in /etc/logroate.conf or /etc/logroate.d/*. You can also define your own crontab entry if the configuration file resides elsewhere, you might also need a state file that will contain the current file rotation tatus.

Most importantly, check man logroate and man 5 logroate.conf to get more idea and options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.