[BACK]Return to wpqops.pm CVS log [TXT][DIR] Up to [local] / wpscripts / wpquotas

File: [local] / wpscripts / wpquotas / wpqops.pm (download)

Revision 1.1, Fri Jun 3 09:28:47 2011 UTC (11 years, 2 months ago) by yason
Branch point for: MAIN

Initial revision

package wpqops;

use wpqio;

my $DU = "/usr/bin/du -md 0 ";
my $MLIMIT = 15360;  # in MBytes


sub wpqops::do_walk($)
{
    my $v = shift;
    my @tmp;
    my $userdir;
    my $username;
    my $amount;
    my $line;
    my $i;
    my @blacklisted;
    
    @tmp = (`$DU$v`);
    
    foreach $line (@tmp)
    {
	chomp($line);
	($amount, $userdir) = split( /\t/, $line, 2);
	
	#
	# This is bad, but it's better than nothing ;-)
	# as usual..
	$user = substr($userdir, 4);
	$user = substr($user, 0, -8);
	
	if($amount > $MLIMIT)
	{
	    wpqio::print("$user has exceeded his limit ($amount)\n");
	    
	    $blacklisted[@blacklisted] = "$user $amount";
	}
    }

    return \@blacklisted;
}

return 1;