[BlueOnyx:06116] Re: Changing quota for all users
Ken - Precision Web Hosting, Inc
kenlists at precisionweb.net
Tue Dec 14 17:22:55 -05 2010
----- Original Message -----
From: "Robert Fitzpatrick" <lists at webtent.net>
To: "BlueOnyx" <blueonyx at blueonyx.it>
Sent: Tuesday, December 14, 2010 1:55 PM
Subject: [BlueOnyx:06115] Changing quota for all users
> Would there by any way to change the quota for all users? We have lots
> of users just setup on a new server with low quota and would like to
> raise all to larger quota. Is the BlueOnyx GUI tied to the underlying
> quota system or does it maintain something on its own for tracking? I
> thought perhaps a 'edquota' script could be written.
>
> --Robert
>
On BQ servers I have used the per script below:
#!/usr/bin/perl
$amounttoadd = 1000;
print"Check quota for list of users and set to used + $amounttoadd\n";
@lsitofusers = `clistuser`;
foreach $usernameall (@lsitofusers) {
chomp ($usernameall);
($username, $nada1, $nada2, $nada3) = split(/\s+/,$usernameall);
chomp ($username);
if (($username !~ /\S{2}/) or ($username eq "admin")) {
next;
}
print "Looking at the quota for $username\n";
@userinfo = `clistuser | grep $username`;
@thequota =`quota $username`;
$allquota = `quota $username`;
print "allquota $allquota \n ";
($value1, $value2, $quotaused, $quotaavail) =
split(/\s+/,$thequota[2]);
$quotaneeded = $quotaused + 100000;
if ( $allquota =~ /: none/) {
print "-------------------------------------\n";
print "contained none, so set to $amounttoadd\n";
$quotaneeded=$amounttoadd;
system("/usr/sbin/cmoduser --name=$username --quota=$quotaneeded ");
} else { next;}
sleep (1);
###################
@userinfo = `clistuser | grep $username`;
@thequota =`quota $username`;
$allquota = `quota $username`;
print "allquota $allquota \n ";
($value1, $value2, $quotaused, $quotaavail) =
split(/\s+/,$thequota[2]);
$quotaneeded = $quotaused + 100000;
if ( $allquota =~ /: none/) {
print "**************************************\n";
print "contained none, so set to $amounttoadd\n";
$quotaneeded=$amounttoadd+1;
system("/usr/sbin/cmoduser --name=$username --quota=$quotaneeded ");
} else { next;}
sleep (1);
###################
###################
@userinfo = `clistuser | grep $username`;
@thequota =`quota $username`;
$allquota = `quota $username`;
print "allquota $allquota \n ";
($value1, $value2, $quotaused, $quotaavail) =
split(/\s+/,$thequota[2]);
$quotaneeded = $quotaused + 100000;
if ( $allquota =~ /: none/) {
print "###########################################\n";
print "It still contained none, so set to $amounttoadd\n";
$quotaneeded=$amounttoadd+2;
system("/usr/sbin/cmoduser --name=$username --quota=$quotaneeded ");
} else { next;}
sleep (1);
###################
@userinfo = `clistuser | grep $username`;
@thequota =`quota $username`;
$allquota = `quota $username`;
print "allquota $allquota \n ";
($value1, $value2, $quotaused, $quotaavail) =
split(/\s+/,$thequota[2]);
if ( $quotaused > $quotaavail ) {
$quotaneeded = $quotaused / 1000;
$quotaneeded = int ($quotaneeded);
$quotaneeded = $quotaneeded + 1000;
print "\nThe quota used for $username is: $quotaused \n";
print "The quota avail for $username is: $quotaavail \n";
print "I will increase the quota to $quotaneeded\n";
system("/usr/sbin/cmoduser --name=$username --quota=$quotaneeded ");
}
}
----
Ken M
Precision Web Hosting, Inc.
http://www.precisionweb.net
More information about the Blueonyx
mailing list