Index: [Article Count Order] [Thread]

Date:  Tue, 23 Dec 2008 22:28:36 -0600
From:  Chris Gebhardt - VIRTBIZ Internet <cobaltfacts (at mark) virtbiz.com>
Subject:  [coba-e:14536] Re: Change quota on multiple users
To:  coba-e (at mark) bluequartz.org
Message-Id:  <4951BA74.6040200 (at mark) virtbiz.com>
In-Reply-To:  <200812240246.17862.bq (at mark) solarspeed.net>
References:  <495151C4.9060506 (at mark) virtbiz.com> <200812240246.17862.bq (at mark) solarspeed.net>
X-Mail-Count: 14536

Thanks Michael...

Michael Stauber wrote:
> Small Perl or shell script, wrapped around the CMU Shell Tools would do 
> nicely.
> 
> 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/get_quotas.pl --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/userquota.pl and put this in it:
> 
> ---------------------------------------------------------------------------------------
> #!/usr/bin/perl 
> 
> # Desired Quota in MB:
> $size = 100
> open( UFILE, "/root/userlist.txt") || die "Cannot open /root/userlist.txt";
> while ( <UFILE>) {
>         chop;
>         ($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.
> 

Hmmm - this looks like it should work, but I'm missing something.  I cut 
and pasted but get this output:

syntax error at ./userquota.pl line 5, near "open"
Execution of ./userquota.pl aborted due to compilation errors.

I'm a really poor perl guy.  Ideas?

-- 
Chris Gebhardt
VIRTBIZ Internet Services
Access, Web Hosting, Colocation, Dedicated
www.virtbiz.com | toll-free (866) 4 VIRTBIZ