Operating System - HP-UX
1819802 Members
3264 Online
109607 Solutions
New Discussion юеВ

/var/mail/root file is very big in size

 
SOLVED
Go to solution
Deepu Chakravarty
Regular Advisor

/var/mail/root file is very big in size

in my server rp8420 root file has become very big. How to reduce the file to zero in size?
12 REPLIES 12
Ganesan R
Honored Contributor

Re: /var/mail/root file is very big in size


Hi,

Just issue the following command to empty the file.

# > filename

or

# cat /dev/null > filename

Thanks.
Best wishes,

Ganesh.
Deepu Chakravarty
Regular Advisor

Re: /var/mail/root file is very big in size

Hi,
whether the command should be like this?

cat /dev/null/root > root.old
Ganesan R
Honored Contributor
Solution

Re: /var/mail/root file is very big in size

Hi,

Could you explain your requirement clearly?

For example, if you want to empty the file /tmp/test.txt use the below command.

# > /tmp/test.txt

or

# cat /dev/null > /tmp/test.txt

Both the above commands will erase the content of the file /tmp/test.txt and make the file size to 0 bytes.

If you want to rename or move to other location, then you may use "cp" or "mv".

Thanks
Best wishes,

Ganesh.
whiteknight
Honored Contributor

Re: /var/mail/root file is very big in size



Hi Deepu,

Please keep this document handy.

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en&docId=emr_na-c00904662-7


Hope this help.

WK
Problem never ends, you must know how to fix it
Dennis Handly
Acclaimed Contributor

Re: /var/mail/root file is very big in size

You can of course use mailx to read the root mail. If you don't want the messages you can remove them:
# mailx
h $
d *
q

If you don't want to change anything, use "x" to exit.
h $: to go to the end, use a message number.
z: to go to next page.
d *: to delete all
d n - m: to delete a range

Using from(1) would give who sent them.
Deepu Chakravarty
Regular Advisor

Re: /var/mail/root file is very big in size

Hi,

I want to keep the /var/mail/root file into another file and make it emptied. I don't want to lose the contents of the file at least for now. At the same time I want to make it zero in size.
Dennis Handly
Acclaimed Contributor

Re: /var/mail/root file is very big in size

>I want to keep the /var/mail/root file into another file and make it emptied.

Then as Ganesan suggested, you use cp:
# cp /var/mail/root /var/mail/root.old
# > /var/mail/root

You can use "mailx -u root.old" to read.

Or you can cat the file onto the end of a Netscape mail folder and then you can sort out all of the "junk" mail.
Prasanth Vattoly
Frequent Advisor

Re: /var/mail/root file is very big in size

Hi deepu ...


check for the reason , why root's mail-inbox is getting very big in size. we were facing the same probs in one server. and we were able to found error in on shell script which is scheduld in cron. this bad entry was making tha mail-inbox in very big size.

So you can look in to this area also

Regards
Prasanrth
prasanth.v.a
Aashique
Honored Contributor

Re: /var/mail/root file is very big in size

Hi Deepu,
Copy your original file then make it blank
At first
cp /var/mail/root /var/mail/root.backup
then
cat /dev/null > /var/mail/root

Thanks & Regards

A. Aashique
Deepu Chakravarty
Regular Advisor

Re: /var/mail/root file is very big in size

Hi,
I did exactly like that. First I copied to a new file and then made it null.

Thanks to all.
whiteknight
Honored Contributor

Re: /var/mail/root file is very big in size

Hi Deepu,

Please assign point to close the case.
have a nice weekend

WC
Problem never ends, you must know how to fix it
Deepu Chakravarty
Regular Advisor

Re: /var/mail/root file is very big in size

Thanks to all specially to Ganeshan and Ashique.