Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting Mail Files 3

Status
Not open for further replies.

SamBones

Programmer
Aug 8, 2002
3,186
US
Howdy,

I've got a userid that has a cron job that's been running for a long time. The person that set it up didn't redirect the script output, so it was mailed to the userid. It also sends out emails that often received mails kicked back in response (eg out of office responses).

Well, the file /var/mail/userid has grown huge, multiple megabytes. Can I just delete this file? Or will it hose something up?

 
No, nothing gets hosed up, but better to:

cp /dev/null /var/mail/userid

Is more atomic and will leave the 0 length file there.

Your user could run procmail to manage the mailbox a little better.
eugene
 
If it's a recalcitrant user who won't change their evil ways, ln -s /dev/null /var/mail/userid. ;-)

Annihilannic.
 
HI,

instead of cp /dev/null /var/mail/userid I would do this:
> /var/mail/userid
This will also zero out the file.
This method can be used to zero out any file and saves all that typing. ;-)
-joe
 
Thanks for all of the suggestions. I cleared it and got the user to change the cron job to behave a little better. Peace has returned to the valley.

I especially like your suggestion Anni. [bigsmile]

Oh, just to give some background information that might be useful to someone else. The mail file didn't fill the file system, but it did take up most of the free space. That particular server crashed for no apparent reason. When looking in [tt]/var/crash[/tt] for a [tt]core[/tt] file from the crash, there was nothing. Apparently if it doesn't have enough space, it doesn't write the [tt]core[/tt] file at all. Anywhere. So, I'm left with nothing but [tt]/var/adm/messages[/tt] for clues to the crash, and all it's showing is the startup messages from the system starting after the crash.

I'm sending an explorer file to Sun to try to diagnose the crash, but any other suggestions on how to diagnose it would be much appreciated. Any ideas anyone?

 
Don't forget to check "dmesg" for symptoms. This may have some handy info also.
 
Thanks spamly. I did, but [tt]dmesg[/tt] just seems to spit out the same things that are in [tt]/var/adm/messages[/tt]. It is any different?

 
It may be too late now, but if you clear some space on /var shortly after the system is booted you can usually re-run savecrash (or is it savecore...?) to attempt to get the core dump again. It should work as long as yoru swap device hasn't been used again since boot time... or any time if your dump device is not your swap device.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top