From owner-freebsd-questions Fri Dec 31 5:34:38 1999 Delivered-To: freebsd-questions@freebsd.org Received: from mgr3.k12.mo.us (bsd.mgr3.k12.mo.us [204.184.227.140]) by hub.freebsd.org (Postfix) with ESMTP id 4E011154A9 for ; Fri, 31 Dec 1999 05:34:36 -0800 (PST) (envelope-from rjn103s@mgr3.k12.mo.us) Received: from redmobile ([172.16.0.5]) by mgr3.k12.mo.us (8.9.3/8.9.2) with SMTP id HAA50020; Fri, 31 Dec 1999 07:44:21 -0600 (CST) (envelope-from rjn103s@mgr3.k12.mo.us) From: Support Reply-To: rjn103s@mgr3.k12.mo.us Organization: Mountain Grove R3 Schools To: jaime@malkav.snowmoon.com Subject: RE: Disk quota & informing non-shell users Date: Fri, 31 Dec 1999 06:28:05 -0600 X-Mailer: KMail [version 1.0.28] Content-Type: text/plain Cc: questions@freebsd.org MIME-Version: 1.0 Message-Id: <99123106404700.00939@redmobile> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Greetings, This is the script I use for quota notification for both shell and non-shell access accounts. You can run it as a cron once a week or something if you want automated notification to the users. Enjoy! #!/usr/bin/perl ############################################################# # Written By Richard Nelson # Ver .1 Date 8/5/99 # This program will run repquota on a file system # sending the output to a file called quota.txt . # From this point the script will open the quota.txt file # in a read only capacity and send a mailer of the information # out to the user. ############################################################### ## # Set Global Vars! ## $quota="/pathToSomewhere/quota.txt"; ## ## run the repquota ## #print "Creating quota information to $quota\n"; system "/usr/sbin/repquota /usr > $quota"; # ## # Open the file and get the info! ## open(FH,"<$quota"); while () { chop; @fields=split ' ',$_; #print "@fields\n"; $used="NONE"; #print "$fields[3]"; # If this test passes that means there is a quota! # Hence we want to notify the user of there used amount! if ($fields[3]> 0){ $used=($fields[2]/$fields[3])*100; $used=int($used); $mb=($fields[3]/1000); $mb=int($mb); $mess="Greetings User $fields[0], You are currently using about $used% of your $mb meg quota at this time."; #print $mess; $command="echo $mess | /usr/bin/mail -s Quota_Report! $fields[0]"; system $command; } } close(FH); print "\nScript Completed!\n"; exit; -- Richard Nelson Try Something Without GPF's - - Not To Mention The Cost:) FreeBSD http://www.freebsd.org RedHat http://www.redhat.com Strong Supporter of Visual Tcl http://www.neuron.com/stewart/vtcl/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message