Operating System - HP-UX
1833059 Members
2526 Online
110049 Solutions
New Discussion

Re: problem with my mailbox

 
SOLVED
Go to solution
Henry Chua
Super Advisor

problem with my mailbox

Hi guys,

I got this problem.. i got many program running on the background, but one of them is constantly flooding my /var/spool/mail:

-rw-rw---- 1 user1 mail 2135295451 Sep 12 14:14 user1

Is there anyway i can find out the culprit?
and how to i flush the mailbox harmlessly?

Regards
Henry
8 REPLIES 8
spex
Honored Contributor

Re: problem with my mailbox

Henry,

Read /var/mail/user1.

PCS
Geoff Wild
Honored Contributor
Solution

Re: problem with my mailbox

I would tail -100 /var/spool/mail/user1
to see what it might be...

To zero the file:

> /var/spool/mail/user1

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.
Peter Godron
Honored Contributor

Re: problem with my mailbox

Henry,
tail -100 user1 should give you a clue as to where the messages come from.
You can empty your mail by overwriting the file or read/delete all your messages from the mailx commandline.
Henry Chua
Super Advisor

Re: problem with my mailbox

Hi guys,

thanks for the info, is there a way i can delete mail from before a certain date?

Best regards
Henry
Steven E. Protter
Exalted Contributor

Re: problem with my mailbox

Shalom,

To delete mail past a certain date you must write a script to do that.

You could also pull the mail onto a PC with popmail if you install qpopper from the Internet Express Suite at http://software.hp.com

> mailbox

Will zero it out but you will lose all of the mail. It is quite harmless.

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
Geoff Wild
Honored Contributor

Re: problem with my mailbox

Here's one I have:

# cat delmail
#!/bin/sh
# script to delete mail older then current month
# gwild
if [ $# -lt 1 -o \( $# -gt 1 -a $# -lt 4 \) ]
then
echo "Usage:"
echo "delmail \"userid\""
echo "Example:"
echo "delmail root"
exit 1
fi

MONTH=`date +%b`
USER=$1
E=`mailx -H -u $USER |grep -v $MONTH |wc -l`
echo "d1-$E" |mailx -u $USER



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.
Peter Godron
Honored Contributor

Re: problem with my mailbox

Henry,
just tried this, but I had a backup !!!

For example for 29th June, as user user1
grep -n -e'Jun 29' /var/mail/user1
In my example line 18
sed "1,17 d" /var/mail/user1 > /tmp/x.x
mv /tmp/x.x /var/mail/user1
chmod 660 /var/mail/user1
chgrp mail /var/mail/user1

mailx still seems to work with the new file, but that may be just my luck !
Geoff Wild
Honored Contributor

Re: problem with my mailbox

Henry - did you get a chance to try the delmail script?

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.