[TriLUG] Over quota script

Jeremy Portzer jeremyp at pobox.com
Sun Sep 15 22:01:34 EDT 2002


On 15 Sep 2002, Jon Carnes wrote:

> Try something like this:
>   #! /bin/bash
>   #
>   # Check for users that are over quota.
>   # Assume all user dirs are under /home
>   # look for folks above 40000kb (quota)
>   #
>   # Walk the users data tree to find the directory totals
>   cd /home
>   du -k > /root/tmp/guber
>   #
>   # Setup the marker for over/under quota folks
>   echo "40000   ###target###" > /root/tmp/guber2
>   #
>   # Isolate the users directory - toss away the subdir info
>   for i in `dir /home`
>   do 
>     grep -w ./$i$ /root/tmp/guber >> /root/tmp/guber2
>   done

You can use the "-s" switch to "du" to avoid this extra step.  For 
example:
	cd /home
	du -sk * | sort -n > /root/tmp/guber2

Regards,
Jeremy




More information about the TriLUG mailing list