Operating System - HP-UX
1830080 Members
27432 Online
109998 Solutions
New Discussion

Big file /etc/mail/rootmail

 
Cliff Lim Kok Hwee
Regular Advisor

Big file /etc/mail/rootmail

Gd Morning Forum,

I discovered that the particular file /etc/mail/rootmail is big 41MB.

-rw-rw---- 1 root mail 41828647 Oct 15 09:30 rootmail

I would like to housekeep it.

Query: Can I just perform #rm /etc/mail/rootmail to housekeep it?

Or other method?

Please advise me.

thanks/cliff
18 REPLIES 18
Steven E. Protter
Exalted Contributor

Re: Big file /etc/mail/rootmail

I think rm is the way to go.

mail is stored in /var/mail/username file.

It would seem that this file may have been accidentially transferred to the /etc folder. Data files really do not belong there.

Knowing your version of sendmail and HP-UX would increase my confidence a wee bit.

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
Cliff Lim Kok Hwee
Regular Advisor

Re: Big file /etc/mail/rootmail

Sorry is /var/mail/rootmail not /etc/mail/rootmail. My typo error.

HPUX 11.00

sendmail(1m) 8.9.3

Thanks guys.

regards/cliff

Steven E. Protter
Exalted Contributor

Re: Big file /etc/mail/rootmail

Well.

That changes everything.

That could be a valid mailfile and the date is current so its being used.

If a mail file gets really huge and I don't feel like actually reading the mail, I do this:

> /var/mail/root

Same thing would work for rootmail

As to why rootmail file is being used, thats probably due to your sendmail configuration, which is currently beyond the scope of this lecture.

Once you get rid of the file the data is gone. You may want to use elm as root (or rootmail) and read the mail first.

Why not rm?

Because the sendmail daemon is probably open and won't be happy if that file just disappears.

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
John Poff
Honored Contributor

Re: Big file /etc/mail/rootmail

Hi,

Before you delete it or null it out, you might want to look at it and see if it has any important information in it. It could be so large just because the mail has never been read, or it could be something is complaining by sending e-mail to root that isn't being seen.

You can also do a 'fuser rootmail' to see if any processes are holding it open. If so, you'll probably want to use SEP's suggestion to null it, as removing an open file doesn't make it go away or free up the space until the processes holding it open have completed.

JP
Cliff Lim Kok Hwee
Regular Advisor

Re: Big file /etc/mail/rootmail

Guys,

[ROOT ctss212]var/mail # fuser rootmail
rootmail:

And nothing is holding onto rootmail it seem.

regards/cliff
Robert-Jan Goossens
Honored Contributor

Re: Big file /etc/mail/rootmail

Cliff,

start elm as user root. Just check the last mails for error messages, if there is nothing importand:
# cp /dev/null /var/mail/root
to create an ampty mail file for root.

Best regards,
Robert-Jan
Cliff Lim Kok Hwee
Regular Advisor

Re: Big file /etc/mail/rootmail

Guys,

I view the /var/mail/rootmail and realised that some application cronjob errors keep reporting error.

#mv /var/mail/rootmail /var/adm/crash
#touch /var/mail/rootmail
#chown root:mail /var/mail/rootmail
#chmod 660 /var/mail/rootmail

Above equivalent to cp /dev/null /var/mail/rootmail?

regards/cliff
Robert-Jan Goossens
Honored Contributor

Re: Big file /etc/mail/rootmail

Yes

Check the cronjobs for errors. You can use

# elm -f /var/adm/crash/rootmail

to read the old messages.

Regards,
Robert-Jan
Cliff Lim Kok Hwee
Regular Advisor

Re: Big file /etc/mail/rootmail

Hi Jim,

#mv /var/mail/rootmail /var/adm/crash
#touch /var/mail/rootmail
#chown root:mail /var/mail/rootmail
#chmod 660 /var/mail/rootmail

Above equivalent to cp /dev/null /var/mail/rootmail?

Which is preferred? Applicable to housekeeping of /var/adm/syslog/syslog.log as well?

regards/cliff
Ian Dennison_1
Honored Contributor

Re: Big file /etc/mail/rootmail

Guys, Guys!

Attached here is a mail file size monitoring program, called "checkmailbox.sh". With a "-v" option it tells you each mail box on the system, how big it is, when the first message is for and how many messages are cron-related.

Run this to see how your mailbox is broken down.

[Another post follows]
Building a dumber user
Ian Dennison_1
Honored Contributor

Re: Big file /etc/mail/rootmail

This script is called "cleanmailbox.sh" (as opposed to "check" previously. It will take a number of months to keep data for (traditionally 1 month minumum) and will trim down the mail box accordingly in lots of 200 messages. The parameter file has 2 entries per line; the mailbox file name (no path!) followed by the number of months to keep.

If u want to be notified when I convert this script to include archiving and retention specified in days, not months, add your name to this thread and monitor it occasionally.

Share and Enjoy! Ian
Building a dumber user
Ian Dennison_1
Honored Contributor

Re: Big file /etc/mail/rootmail

Merde! 4got the script.
Building a dumber user
Geoff Wild
Honored Contributor

Re: Big file /etc/mail/rootmail

I usually cat /dev/null to it, but it is better to read the mail on a usual basis - then delete...

Ian - nice script(s), but what is in:

/operations/etc/mailmonitor.cfg

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: Big file /etc/mail/rootmail

Ian - nevermind - figured it out. Doh!
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
claudio_22
Regular Advisor

Re: Big file /etc/mail/rootmail

Hi Ian ,

about your interesting and useful script " cleanupmailbox.sh " .. it's not clear to me

I've created /operations/etc/mailtrim.cfg inserting ' root 2 ' for 2 months retention period ; but what i should insert in ' /operations/etc/monthnumbers ' file ?

Thanks

Regards


Ian Dennison_1
Honored Contributor

Re: Big file /etc/mail/rootmail

Sorry, the following is the contents of /operations/etc/monthnumbers

bc02n0v0> cat /operations/etc/monthnumbers
1 Jan
2 Feb
3 Mar
4 Apr
5 May
6 Jun
7 Jul
8 Aug
9 Sep
10 Oct
11 Nov
12 Dec
13 Jan
14 Feb
15 Mar
16 Apr
17 May
18 Jun
19 Jul
20 Aug
21 Sep
22 Oct
23 Nov
24 Dec

This is designed this way to handle wrap-around of calender months and years. Sorry I omitted it, I will add its creation to the program.

NOTE: You can only to back 11 months this way, anything more than a year is not catered for.

The core of the trim program is 2 steps,...
Find the number of lines of emails before the current date
Send delete commands thru a pipe to "mailx"

Share and Enjoy! Ian
Building a dumber user
Ian Dennison_1
Honored Contributor

Re: Big file /etc/mail/rootmail

Dang, make those month numbers 2 digits, zero-filled. I'm not having a good week here!

Share and Enjoy! Ian
Building a dumber user
claudio_22
Regular Advisor

Re: Big file /etc/mail/rootmail

Thanks !

Work now . Very good .

I'll look sometimes to this 3d for any
script improvment

Regards