Return to BSD News archive
From: pict <pict@crush.net>
Newsgroups: comp.unix.bsd.bsdi.misc
Subject: Re: Help a UNIX Girl :)
Date: Sat, 10 May 1997 00:18:05 -0500
Organization: College Connections
Lines: 46
Message-ID: <3374050D.4BAB2F3B@crush.net>
References: <5kuqjf$8ia$1@news.NetVision.net.il>
NNTP-Posting-Host: 207.170.83.114
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 3.01 (X11; I; Linux 2.0.0 i586)
To: Caroline Parker <wlidir@netvision.net.il>
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!metro!munnari.OZ.AU!uunet!in3.uu.net!206.154.70.8!news.webspan.net!ix.netcom.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!newsfeed.internetmci.com!news.nol.net!yakuza.fc.net!news.fc.net!usenet
Xref: euryale.cc.adfa.oz.au comp.unix.bsd.bsdi.misc:6877
Caroline Parker wrote:
>
> Hi Friends!!!
>
> I have a little question, i have a Virtual Server in a BSDI Box, now,
> i made Directories in which people can put their WEBPAGES and graphics...
> The users can also create directories inside their root directories ok?
>
> Now, i need to check that they DO NOT put more files over 3 Mega.
> I need to modify this line to check if their WHOLE directory and subdirectories (if they exist)
> DO NOT HAVE MORE THAN THE 3 Mega, in that case, send me an e-mail with
> the directory's name and memory amount that he is taking.
> I made something similar to check e-mail box files size..... with the cronfile....
>
> 07 1 * * * find usr/mail/ -type f -size +102400c -print | mail -s 'OVER 100k Files' caroline@mydomain.com
>
> PLEASE!.. help me to modify this line to let me check the users directories...
> Thank YOU VERY MUCH!
> I have NOT POSIBILITY in my system TO USE THE QUOTAs to do this...
>
> Caroline :)
This Perl script should do the job =)
#! /usr/bin/perl
chdir "/wherever/user_homedirs";
for (<*>)
{
$size = `du -s $_`;
split(/\s+/, $size);
if($_[0] > 100) # or whatever size you wish
{
open(outmail, "| mail -s \"OVER limit\" caroline@yourdomain.com");
print outmail $size;
close(outmail);
}
}
Also read the man page on ``du'' so you know what the number it is
giving you :)
Ian Fink
ian@crush.net