Operating System - HP-UX
1820636 Members
1851 Online
109626 Solutions
New Discussion юеВ

How to delete mail messages

 
SOLVED
Go to solution
feryfarah
Advisor

How to delete mail messages

Hi,
I have a large size of root mail in my HP-UX server.
I tried to delete by using #rm command but it didn't work.
I tried to delete using d command when i'm in the root mail (using #more command), but it still didn't work.
My /var directory space is getting compact (over 95% utilized) and I'm in the process of deleting unnecessary files in /var directory.

Please assist me.
Thanks
19 REPLIES 19
Mridul Shrivastava
Honored Contributor

Re: How to delete mail messages

check the files under /var/mail and locate the largest file.

Take a backup of that file or copy it on other filesystem then nullify this file using the cat command as below

cat > /var/mail/

This will create more space under /var
Time has a wonderful way of weeding out the trivial
feryfarah
Advisor

Re: How to delete mail messages

Hi,
I tried to use cat command and inserted:-
hi
my name


when I read back the mail...messages as below keep coming...

hi
my name
ern_file...] [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] [-e pattern_list...]
-f pattern_file... [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] pattern [file...]
grep: illegal option -- 3
grep: illegal option -- 4
grep: illegal option -- 2
grep: illegal option -- 0
grep: illegal option -- 0
grep: illegal option -- 0
grep: illegal option -- 8
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] -e pattern_list...
[-f pattern_file...] [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] [-e pattern_list...]
-f pattern_file... [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] pattern [file...]
grep: illegal option -- 3
grep: illegal option -- 4
grep: illegal option -- 0
grep: illegal option -- 4
grep: illegal option -- 0
grep: illegal option -- 4
grep: illegal option -- 7
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] -e pattern_list...
[-f pattern_file...] [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] [-e pattern_list...]
-f pattern_file... [file...]
usage: grep [-E|-F] [-c|-l|-q] [-bhinsvx] pattern [file...]
grep: illegal option -- 3
grep: illegal option -- 4
grep: illegal option -- 0
grep: illegal option -- 4
grep: illegal option -- 0
grep: illegal option -- 4
.
.
.
the size keep bigger.
# ls -l
total 471136
-rw-rw---- 1 root mail 234728993 Jan 7 10:34 root
# ls -l
total 471136
-rw-rw---- 1 root mail 239718479 Jan 7 10:34 root
# ls -l
total 503904
-rw-rw---- 1 root mail 252432821 Jan 7 10:34 root
Mridul Shrivastava
Honored Contributor

Re: How to delete mail messages

use the following command to nullify then

cat /dev/null > /var/mail/root

Make sure that u have a backup of this root file before executing this command.
Time has a wonderful way of weeding out the trivial
feryfarah
Advisor

Re: How to delete mail messages

Thanks.
I managed to empty the root mail.
But it keeps filling in with the unknown message.
Mridul Shrivastava
Honored Contributor

Re: How to delete mail messages

Since when It started, I mean was there any changes made after that this problem started???

Normally all root mails will go to to root and this file size increases but if it is increasing with in a day or so then it is a thing to look out...

Is there any other error message ??
How abt the mail delivery, are the messages being delivered by the system ??
Time has a wonderful way of weeding out the trivial
feryfarah
Advisor

Re: How to delete mail messages

I didn't notice when it started.
hope u'll find something from this.

From MAILER-DAEMON@hpovnnm Mon Jan 7 11:00:22 mal 2008
Received: from localhost (localhost)
by hpovnnm (8.9.3 (PHNE_29774)/8.9.3) with internal id SLD25533;
Fri, 4 Jan 2008 20:50:37 +0800 (mal)
Date: Fri, 4 Jan 2008 20:50:37 +0800 (mal)
From: Mail Delivery Subsystem
Message-Id: <200801041250.SLD25533@hpovnnm>
To: postmaster@hpovnnm
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="SLD25533.1199451037/hpovnnm"
Subject: Postmaster notify: Cannot send message within 5 days
Auto-Submitted: auto-generated (postmaster-notification)

This is a MIME-encapsulated message

--SLD25533.1199451037/hpovnnm

The original message was received at Sun, 30 Dec 2007 05:33:24 +0800 (mal)
from localhost

----- The following addresses had permanent fatal errors -----
root
(expanded from: postmaster)

----- Transcript of session follows -----
mail: cannot append to /var/mail/root
mail: cannot create dead.letter
451 I/O error
Message could not be delivered for 5 days
Message will be deleted from queue

--SLD25533.1199451037/hpovnnm
Content-Type: message/delivery-status

Reporting-MTA: dns; hpovnnm
Arrival-Date: Sun, 30 Dec 2007 05:33:24 +0800 (mal)

Final-Recipient: RFC822; postmaster@hpovnnm
X-Actual-Recipient: RFC822; root@hpovnnm
Action: failed
Status: 4.4.7
Last-Attempt-Date: Fri, 4 Jan 2008 20:50:37 +0800 (mal)

--SLD25533.1199451037/hpovnnm
Content-Type: message/rfc822

Return-Path:
Received: from localhost (localhost)
by hpovnnm (8.9.3 (PHNE_29774)/8.9.3) with internal id EIR27294;
Sun, 30 Dec 2007 05:33:24 +0800 (mal)
Date: Sun, 30 Dec 2007 05:33:24 +0800 (mal)
From: Mail Delivery Subsystem
Message-Id: <200712292133.EIR27294@hpovnnm>
To: postmaster
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="EIR27294.1198964004/hpovnnm"
Subject: Postmaster notify: Cannot send message within 5 days
Auto-Submitted: auto-generated (postmaster-notification)

This is a MIME-encapsulated message

--EIR27294.1198964004/hpovnnm

The original message was received at Tue, 25 Dec 2007 02:06:15 +0800 (mal)
from localhost

----- The following addresses had permanent fatal errors -----
root
(expanded from: postmaster)

----- Transcript of session follows -----
mail: cannot append to /var/mail/root
mail: cannot create dead.letter
451 I/O error
Message could not be delivered for 5 days
Message will be deleted from queue

--EIR27294.1198964004/hpovnnm
Content-Type: message/delivery-status

Reporting-MTA: dns; hpovnnm
Arrival-Date: Tue, 25 Dec 2007 02:06:15 +0800 (mal)

Final-Recipient: RFC822; postmaster@hpovnnm
X-Actual-Recipient: RFC822; root@hpovnnm
Action: failed
Status: 4.4.7
Last-Attempt-Date: Sun, 30 Dec 2007 05:33:24 +0800 (mal)

--EIR27294.1198964004/hpovnnm

Mridul Shrivastava
Honored Contributor

Re: How to delete mail messages

I understand that there were lots of messages in queue and unable to append the root file and now they can not be delivered since it is more that 5 days now.

What is the current status of the root mails and file size ??

try sending a test message ad check if it succeeds:
mailx -s "test"
test
.

then tail -f /var/adm/syslog/mail.log

check if stat is equal to sent or not ??
Time has a wonderful way of weeding out the trivial
feryfarah
Advisor

Re: How to delete mail messages

here is the result.

# mailx -s "test" 200801041250.SLD25533@hpovnnm
test
EOT
#
# tail -f /var/adm/syslog/mail.log
Nov 15 14:16:58 hpovnnm sendmail[23463]: SDN19702: to=root, delay=1+15:04:55, xdelay=00:00:00, mailer=local, stat=I/O error
Nov 15 14:16:59 hpovnnm sendmail[23463]: SGG11673: to=root, delay=1+16:27:43, xdelay=00:00:01, mailer=local, stat=I/O error
Nov 15 14:16:59 hpovnnm sendmail[23463]: RZQ16262: to=root, delay=1+17:42:56, xdelay=00:00:00, mailer=local, stat=I/O error
Nov 15 14:16:59 hpovnnm sendmail[23463]: RHA16262: to=root, delay=1+18:09:39, xdelay=00:00:00, mailer=local, stat=I/O error
Nov 15 14:16:59 hpovnnm sendmail[23463]: SYP11673: to=root, delay=1+15:55:37, xdelay=00:00:00, mailer=local, stat=I/O error
Nov 15 14:17:00 hpovnnm sendmail[23463]: RcN16262: to=root, delay=1+17:34:26, xdelay=00:00:01, mailer=local, stat=I/O error
Nov 15 14:17:00 hpovnnm sendmail[23463]: RqE16262: to=root, delay=1+17:20:48, xdelay=00:00:00, mailer=local, stat=I/O error
Nov 15 14:17:00 hpovnnm sendmail[23463]: RZI16262: to=root, delay=1+17:43:15, xdelay=00:00:00, mailer=local, stat=I/O error
Nov 15 14:17:00 hpovnnm sendmail[23463]: RZR16262: to=root, delay=1+17:42:56, xdelay=00:00:00, mailer=local, stat=I/O error
Nov 15 14:17:00 hpovnnm sendmail[23463]: SFY11673: to=root, delay=1+16:28:38, xdelay=00:00:00, mailer=local, stat=I/O error
Nov 15 14:17:01 hpovnnm sendmail[23463]: SFN11673: to=root, delay=1+16:29:3#
#
# ls -l
total 4355184
-rw-rw---- 1 root mail 2147483647 Jan 7 11:32 root
Mridul Shrivastava
Honored Contributor

Re: How to delete mail messages

There is an I/o error so mails are not getting delivered.. please check if sendmail daemon is running or not.

ps -ef|grep sendmail


Time has a wonderful way of weeding out the trivial
feryfarah
Advisor

Re: How to delete mail messages

# ps -ef|grep sendmail
root 1149 1 0 Jan 3 ? 1:25 sendmail: accepting connections on port 25
root 23239 1149 71 11:20:30 ? 2:07 sendmail: WkA21954: from queue
root 9086 1067 1 12:27:16 pts/tg 0:00 grep sendmail
root 8554 1149 82 09:50:15 ? 4:58 sendmail: WfW21954: from queue
root 27325 1149 73 10:20:20 ? 3:44 sendmail: BHG06541: from queue
root 12383 1149 75 11:50:35 ? 1:10 sendmail: CQK05394: from queue
root 17450 1149 81 08:50:05 ? 9:03 sendmail: BGN06541: from queue
root 22168 1149 76 10:50:25 ? 2:51 sendmail: WgP21954: from queue
root 29921 1149 74 12:20:40 ? 0:11 sendmail: EQP26209: from queue
root 7365 1149 93 04:49:24 ? 17:06 sendmail: DAA05755: from queue
root 4421 1149 77 09:20:10 ? 6:37 sendmail: WPQ05845: from queue
#

what should I do?
Mridul Shrivastava
Honored Contributor

Re: How to delete mail messages

sendmail is running and listening at port 25... There are lots of sendmail processes running.. may be in hung stat

Can you try stoping the sendmail process using "/sbin/init.d/sendmail stop"

then kill the other sendmail processes if any.
Then start the sendmail again using the following
/sbin/init.d/sendmail start

then check using ps command that it is listening at port 25 then test by sending a test mail as we did earlier.
Time has a wonderful way of weeding out the trivial
VK2COT
Honored Contributor
Solution

Re: How to delete mail messages

Hello,

Having a mailbox size in GBytes
is not an ideal situation :)

Let's try to "attack" the problem from two fronts:

1. Deal with MTA sendmail

2. Deal with root mailbox

For the MTA, do the following:

a) Stop sendmail master daemon:

/sbin/init.d/sendmail stop

b) Kill the remaining sendmail child
processes.

c) Since the hung messages do not seem to
be of importance, remove them from the queue:

rm -f /var/spool/mqueue/*

d) Remove root's mailbox:

rm -f /var/mail/root

e) Check free space in /var file system and
also ensure that permissions on /var/mail
and /var/spool/mqueue directories are OK.

f) Check email delivery status for
root:

/usr/sbin/sendmail -bv -v -oL10 root

g) Restart sendmail:

/sbin/init.d/sendmail start

Then, send a message to another (non-root)
account:

mailx -s "test" someusername

If it works, repeat for root:

mailx -s "test" root

or even better:

/usr/sbin/sendmail -v root
CTRL-D

Let us know what happens.

Cheers,

VK2COT
VK2COT - Dusan Baljevic
feryfarah
Advisor

Re: How to delete mail messages

Hi all,
I did all the steps.
1.Root can send mail to other user.
2.Size of mail root has decreased.
3.Var has only 33% utilization from 83% !!!
4.What is the Warning message as below means?

# /usr/sbin/sendmail -bv -v -oL10 root
WARNING: local host name (hpovnnm) is not qualified; fix $j in config file
root... deliverable: mailer local, user root
#
# /usr/sbin/sendmail -v root
WARNING: local host name (hpovnnm) is not qualified; fix $j in config file
root... Connecting to local...
root... Sent
#


Thanks all.
You all did great help on this...
VK2COT
Honored Contributor

Re: How to delete mail messages

Hello,

Goot to see you are operational again :)

Your problem with short hostname is easily resolved in one of two ways:

a) Simplest method - add or change the entry in /etc/hosts. For example:

192.168.1.55 myhost.mydom.dom myhost

You probably have something like the following currently:

192.168.1.55 myhost

b) Or, uncomment the following line in the
/etc/mail/sendmail.cf file by deleting the pound sign (#) at the beginning of the following line:

Dj$w.Foo.COM

Change Foo.COM to the name of your domain (for example, mydom.dom).

Cheers,

VK2COT

VK2COT - Dusan Baljevic
Mridul Shrivastava
Honored Contributor

Re: How to delete mail messages

What is hosts set to in /etc/nsswitch.conf?

Probably just files.

Should be

files [ NOTFOUND=continue ] dns


Next, your /etc/resolv.conf needs to contain the ip's of your dns servers.


Now, in your own domain, do you have a smart relay server? if yes, then on "Care Manager 9" server in /etc/mail/sendmail.cf set the DS macro to that smart relay server:
Time has a wonderful way of weeding out the trivial
feryfarah
Advisor

Re: How to delete mail messages

Hi,

Is this the answers I'm looking for to solve the warnings????
Mridul Shrivastava
Honored Contributor

Re: How to delete mail messages

Yes.. please check the settings as mentioned above and let us know the outcome
Time has a wonderful way of weeding out the trivial
feryfarah
Advisor

Re: How to delete mail messages

Hi all,

I am just interested to decrease the percentage of /var directory utilization.
It has helped me a lot.

Thanks.
feryfarah
Advisor

Re: How to delete mail messages

Thanks :)