Index: [Article Count Order] [Thread]

Date:  Wed, 24 Dec 2008 02:46:17 +0100
From:  Michael Stauber <bq (at mark)>
Subject:  [coba-e:14532] Re: Change quota on multiple users
To:  coba-e (at mark)
Message-Id:  < (at mark)>
In-Reply-To:  <495151C4.9060506 (at mark)>
References:  <495151C4.9060506 (at mark)>
X-Mail-Count: 14532

Hi Chris,

> We have a customer that would like to increase quota globally across
> over 100 users on their site.
> Is there a good way to automate this?  Clicking through each user in the
> GUI will be a slow process.

Small Perl or shell script, wrapped around the CMU Shell Tools would do 

First create a textfile with the name of all users of that site in it. Lets 
say the site is "site1". In that case you can use the command as shown below:

/usr/sausalito/sbin/ --site=site1 | awk '{print $1}'| grep -v 
SITE > /root/userlist.txt

Afterwards you'll have the textfile /root/userlist.txt with all usernames of 
that site -  one username by line.

Then create the perl script /root/ and put this in it:


# Desired Quota in MB:
$size = 100
open( UFILE, "/root/userlist.txt") || die "Cannot open /root/userlist.txt";
while ( <UFILE>) {
        ($user) = split /\//;
        print "Setting quota for " .  $user . " to " . $size . " MB. \n";
        system ("/usr/sbin/cmoduser --name $user --set-quota $size");
close (UFILE);

That script will then set all users from the textfile to a quota of 100MB.

With best regards,

Michael Stauber