Date: Fri, 31 Dec 1999 06:28:05 -0600 From: Support <rjn103s@mgr3.k12.mo.us> To: jaime@malkav.snowmoon.com Cc: questions@freebsd.org Subject: RE: Disk quota & informing non-shell users Message-ID: <99123106404700.00939@redmobile>
next in thread | raw e-mail | index | archive | help
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 (<FH>) { 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?99123106404700.00939>