Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2004 11:13 AM
07-02-2004 11:13 AM
Some of the files in the /var/mail folder are growing very fast.
I am looking for a script which read/list all the files under /var/mail and trim the files which are more than 2 MB in size.
Thank you,
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2004 12:15 PM
07-02-2004 12:15 PM
Solutiondue to this fact, instead of trimming the files, I would suggest one of the two things :
1) if any particular user does not read his/her emails, it means that they do not need it and it can and should be turned off.
2) if they really need it, but can not find time to read them, you can place a .forward file under these users' home directory and put their company-wide email address into this file and they will receive the mail in their outlook mailbox or what have you and they need to handle the growing mailbox pressure, not you.
At the end it is the users' email not yours to trim when the filesystem blows up.
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2004 12:21 PM
07-02-2004 12:21 PM
Re: script
cd /var/mail
for file in `find . -size +2000000c`
do
linecount=`cat $file | wc -l`
let trimamount=$linecount/10 # trimming 10% here, change as you wish
sed -e 1,${trimamount}d $file > /tmp/temp_mail_file
mv /tmp/temp_mail_file $file
done
as these files grow at the bottom, you want to trim them from the top.
hope this helps
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2004 07:29 PM
07-02-2004 07:29 PM
Re: script
Kaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2004 07:50 PM
07-02-2004 07:50 PM
Re: script
If possible go fo the solution which kapil
proposed.
You cannot trust user for which mail they
will come to you and ask you to retrieve
so better add a disk and add it to
the /var/mail volume.
Thanks,
Amit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2004 02:11 AM
07-06-2004 02:11 AM
Re: script
You can't coddle users, if you do they will walk all over you and your system.
We have a similar problem with cron sending mail to root. Since no one usually logs on to root as normal practice, his mail file can really grow with mostly non-useful information.
Remember that data will expand to fill all of your available diskspace. :-)
If you thought being a system admin would make you popular, you'd best think again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2004 02:35 AM
07-06-2004 02:35 AM
Re: script
>> You can't coddle users, if you do they will walk all over you and your system.
Interesting point of view. Where I come from the system is there for the users. They own it. The system administrator is the facilitator, not a dictator / owner.
>> If you thought being a system admin would make you popular, you'd best think again.
I suppose that would be the natural consequence of treating the users as 'the enemy' that are reluctantly tolerated on 'your system'.
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2004 03:28 AM
07-06-2004 03:28 AM
Re: script
Sysadmin is not and should not be a dictator, but if a user is misbehaving, it is the sysadmin's role to be police/judge to penalize them. It would be nice if we all lived in a world where every user was a responsible person and clean up after themselves but this is what the fantasy role playing games are for :) Isn't it ?
Cheers.
UNIX because I majored in cryptology...