LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-13-2006, 10:25 AM   #1
Reegz
Member
 
Registered: Mar 2006
Location: South Africa
Distribution: Ubuntu, Slackware, openSuse
Posts: 44

Rep: Reputation: 15
Clearing /var/spool/mail/root


ok, i've searched the forums and good ol google, but yet an answer eludes me.

i'm trying to set up a cron job that will delete mail in /var/spool/mail/root which is older than a month.

I know that the manual way to do it would be to type

Code:
mail
and then delete it from there. Is there a way in which this process can be automated??

Thanks
 
Old 09-13-2006, 12:01 PM   #2
kstan
Member
 
Registered: Sep 2004
Location: Malaysia, Johor
Distribution: Dual boot MacOS X/Ubuntu 9.10
Posts: 851

Rep: Reputation: 31
write a script like this (maybe clearroot.sh)

#!/bin/bash
rm -f /var/spool/mail/root (I assure root is file, if folder then -rf)

save the file in /etc/cron.daily
chmod +x clearroot.sh

everyday ~4am it will clear the file for u
 
Old 09-13-2006, 02:09 PM   #3
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
The post above will delete all the mail. If you want to delete mbox mail that is one month or older then there are severl perl script that can do this for you. I think you can also do it using mutt command line parameters which you can put on a cron script.
 
Old 09-14-2006, 01:53 AM   #4
Reegz
Member
 
Registered: Mar 2006
Location: South Africa
Distribution: Ubuntu, Slackware, openSuse
Posts: 44

Original Poster
Rep: Reputation: 15
Thanks for your reply but thats not what i'm looking to do

Quote:
Originally Posted by kstan
write a script like this (maybe clearroot.sh)

#!/bin/bash
rm -f /var/spool/mail/root (I assure root is file, if folder then -rf)

save the file in /etc/cron.daily
chmod +x clearroot.sh

everyday ~4am it will clear the file for u
 
Old 09-14-2006, 09:07 AM   #5
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
OK, now I remember! It is called mbox-purge.pl - it is a perl script that will allow you to purge old email messages from your mailbox or from a group of mailboxes; all done with a command. I used it years ago for doing the exact same thing while administering mega mailboxes. Below is the link for the project page.

http://freshmeat.net/projects/mboxpu...ease_id=235118

Here's the man page with examples:

http://www.argon.org/~roderick/mbox-purge.html

For further info google "mbox-purge".

You can also do it using webmin, which is very nice and easy to use with a browser.
 
Old 09-15-2006, 05:07 AM   #6
Reegz
Member
 
Registered: Mar 2006
Location: South Africa
Distribution: Ubuntu, Slackware, openSuse
Posts: 44

Original Poster
Rep: Reputation: 15
Cool thanks. I'll have a look at it.

Quote:
Originally Posted by ramram29
OK, now I remember! It is called mbox-purge.pl - it is a perl script that will allow you to purge old email messages from your mailbox or from a group of mailboxes; all done with a command. I used it years ago for doing the exact same thing while administering mega mailboxes. Below is the link for the project page.

http://freshmeat.net/projects/mboxpu...ease_id=235118

Here's the man page with examples:

http://www.argon.org/~roderick/mbox-purge.html

For further info google "mbox-purge".

You can also do it using webmin, which is very nice and easy to use with a browser.
 
Old 09-15-2006, 09:50 AM   #7
Reegz
Member
 
Registered: Mar 2006
Location: South Africa
Distribution: Ubuntu, Slackware, openSuse
Posts: 44

Original Poster
Rep: Reputation: 15
The script works brilliantly!!!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to open mail spool file /var/mail/root cccc Debian 4 09-14-2006 01:31 PM
/var/spool/mail/root mail message absalon Linux - General 1 07-04-2005 09:08 PM
How to read /var/spool/mail/root? neo_in_matrix Linux - Newbie 1 04-04-2005 08:49 PM
Spam in /var/spool/mail/root Nutska1 Linux - Networking 4 06-11-2004 02:35 PM
/var/spool/mail/root j-me Linux - Newbie 5 02-14-2003 06:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:58 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration