- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: mail command to purge mail
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2002 05:31 PM
01-16-2002 05:31 PM
mail command to purge mail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2002 05:52 PM
01-16-2002 05:52 PM
Re: mail command to purge mail
The following command will remove all files
in /var/mail that have not been modified in the last 30 days. You could change the option 'mtime' to 'atime' and this would only then remove files that have not been accessed in the last 30 days.
find /var/mail -mtime +30 -exec rm {} \;
HTH
-Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2002 06:12 PM
01-16-2002 06:12 PM
Re: mail command to purge mail
Actually my problem is I have so many incoming mail in one of the mailbox. I just to keep one month old of the incoming mail in that particular mailbox.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2002 06:49 PM
01-16-2002 06:49 PM
Re: mail command to purge mail
Hi,
elm was never designed to the task that you want. elm is used to cater for individual mailboxes.
Have a look at the HP porting centre and of
course GNU, you just may find something of
use.
http://hpux.cs.utah.edu/
and
http://www.gnu.org/software/software.html
Only other suggestion I can make is to look
at commercial mail package. Only one I know of
is openmail.
HTH
-Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2002 10:20 PM
01-16-2002 10:20 PM
Re: mail command to purge mail
You can perform some crude but easy steps to trim your mailbox from the command line. You can also perform the below steps in a script so that you can flexibly add options to triming your mailbox.
Example, you want to clear your root mailbox and save only mails from a specific date and time.
1) Get all email timestamps for Jan 2002:
# grep "^From " root | grep " 2002$" | grep " Jan "
From root Thu Jan 17 13:01:45 2002
From root Thu Jan 17 13:16:42 2002
From root Thu Jan 17 13:31:46 2002
From root Thu Jan 17 13:46:37 2002
From root Thu Jan 17 13:50:09 2002
2) Select the email timestamp you want to start saving your emails from (in this case, Jan 17 13:46:37) and pinpoint the line number (in this case, 69817) in your mail file:
# cat -n root | grep "From root Thu Jan 17 13:46:37 2002"
69817 From root Thu Jan 17 13:46:37 2002
3) Extract your emails from the mail file starting from this line number (69817) onwards:
# tail +69817 /var/mail/root > /tmp/root.mail
4) Update your /var/mail/root mail file:
# mv -f /tmp/root.mail /var/mail/root
Hope this helps. Regards.
Steven Sim Kok Leong