Operating System - HP-UX
1836438 Members
2518 Online
110100 Solutions
New Discussion

Re: script to cleanup email

 
Gary Glick
Frequent Advisor

script to cleanup email

Howday all,
Can anyone think of a way to cleanup system email to say the root user without being able to invoke mailx or elm, etc. like parse an email file and selectively keep or discard messages based on some certain criteria, received date, sender, etc.

This isn't a high priority, I can always move/delete the /var/mail/root file out of the way and start new, or I could extend /tmp so I can actually open the file (over 300MB). I was just thinking that if I could do some general cleanup from a script it would save me some time in the long run.

Thanks

Gary




4 REPLIES 4
Mel Burslan
Honored Contributor

Re: script to cleanup email

I think what you need is something like procmail. Check this page for download and some information about it:

http://hpux.cs.utah.edu/hppd/hpux/Networking/Mail/procmail-3.22/

HTH
________________________________
UNIX because I majored in cryptology...
Steven E. Protter
Exalted Contributor

Re: script to cleanup email

Shalom,

I run a script once a week on 9000 and Linux servers.

it does this:

> /var/mail/root

And for any other users I don't want to receive the mail for.

It would seem you need a larger /var filesystem for this situation.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Ivan Ferreira
Honored Contributor

Re: script to cleanup email

Here are some perl scripts that allows you to do that:

www.mirror.ac.uk/mirror/ftp.funet.fi/ pub/languages/perl/CPAN/scripts/mailstuff/expire_mail.pl

http://www.sunmanagers.org/archives/1995/0297.html

http://www.kenjun.com/index2.php?option=com_content&do_pdf=1&id=875
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
Bill Hassell
Honored Contributor

Re: script to cleanup email

procmail is available from HP too (along with lots of other tools):

http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=HPUXIEXP1111


Bill Hassell, sysadmin