LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Mail File Sizes and Truncating Them (https://www.linuxquestions.org/questions/linux-server-73/mail-file-sizes-and-truncating-them-542688/)

mcupples 04-02-2007 11:55 AM

Mail File Sizes and Truncating Them
 
Hey everyone!

My box (fc3) has sendmail (v8.x) installed and configured. My issue is that root gets about 405983495083 messages a day and his mailbox yields >100mb a week. It's now nearing a gig and I was wondering if it were possible to set up a cron to delete all his messages.

Now, I've gone into /var/spool/mail/ and replaced the mailbox file with a blank file - but that makes the mailbox not accessible from pine (not sure if it works still or not but it doesn't matter as I can't read those messages). Is there a command that I'm not aware of that can replace mailboxes with blank mailboxes?

Please feel free to give an alternate solution to the one I'm asking for as I'm not necessarily married to that idea.

Thanks!

benjithegreat98 04-02-2007 03:34 PM

On the command line with root access type mail

It should show several messages. Type d *
This will delete all messages. Type x to quit.

mcupples 04-02-2007 04:21 PM

Thanks for your quick reply - but this appears to have only opened up new issues. I'm pretty sure that my mailbox is just too big. It's currently at ~700mb.

[root@db mcupples]# mail
d *Mail version 8.1 6/6/93. Type ? for help.
"/var/spool/mail/root": 139232 messages 38639 new 139214 unread
fseek: Invalid argument
panic: temporary file seek
Segmentation fault
[root@db mcupples]#

The panic just worries me. I'm going to go google this and hopefully find something. Let me know if you think of anything first.

Thanks!

benjithegreat98 04-02-2007 04:53 PM

If you simply rename the file to something else, will pine bomb out after that? It would basically be like deleting the file. When it needs to put another email in the file it will just recreate the file...

mcupples 04-03-2007 08:49 AM

I guess I just did it wrong yesterday. Strange. It works when I just "mv root rootytooty", just re-creates the root file. I guess I can delete rootytooty now.

As soon as I deleted it I had five new messages about mail failures. :( I think I've got to install that check root kit or something.

benjithegreat98 04-03-2007 08:54 AM

I would check to make sure you didn't accidentally setup an open relay. Maybe a node inside your network has a virus and is using your server as it's relay......

Checking for a rootkit is not a bad idea either.

/var/log/maillog might help to find the origination point of these emails....

mcupples 04-03-2007 08:59 AM

Much thanks for all your help. Looks like I have to do some work now. :)


All times are GMT -5. The time now is 02:08 PM.