Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Jun 2001 07:20:49 -0400 (EDT)
From:      Jaime <jaime@snowmoon.com>
To:        whisky <whisky@macroshell.net>
Cc:        questions@freebsd.org
Subject:   Re: Quotas Problem
Message-ID:  <Pine.BSF.4.21.0106190714590.17792-100000@malkav.snowmoon.com>
In-Reply-To: <002301c0f88f$e1fadda0$0100000a@whisky>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 19 Jun 2001, whisky wrote:
> I setup group quotas via 
> # edquota -g groupinquestion
> 
> and instead of setting the quota for every user in the group...

	This is what it is supposed to do.


> # edquota -u username
> and then the script edit the blocks/inodes (I suck at coding)

	If this is what you want, read the manual for edquota more
closely.  There is an option "-p" that will be useful to you.  If you can
do *any* coding, stick a call to this inside a look.  For example, in
perl:

foreach (@users)
  {
  $cmd = "/usr/sbin/edquota -u -p $ARGV[1] $_";
  system("$cmd");
  print ".";
  }

	I found the following script lieing around in my utilities
directory.  I can't remember if it works or not, but feel free to try it.

#!/usr/bin/perl
#
#The purpose of this script is to read a file full of usernames,
#one username per line, and set all of their disk quotas to be
#the same as that of one specific user.
#
if ((!($ARGV[0])) || (!($ARGV[1])))
        {
        die "$0 <file of usernames> <template user>\n";
        }
open(LIST,"$ARGV[0]") || die "Error:  Could not open file $ARGV[0].\n\n";
@users=<LIST>;
close(LIST);
print "Users to edit:\n\n";
foreach (@users)
        {
        chop;
        print $_ . "\n";
        }
print "\nPermanently replace quota settings of these users with quota of $ARGV[1]?\n";

$confirm="foo";
while ((!($confirm eq "n")) && (!($confirm eq "y")))
        {
        print "(y/n)";
        $confirm=<STDIN>;
        chop($confirm);
        }
if ($confirm eq "y")
        {
        print "If you insist....\n";
        print "Working";
        foreach (@users)
                {
                $cmd = "/usr/sbin/edquota -u -p $ARGV[1] $_";
                system("$cmd");
                print ".";
                }
        }
        else
        {
        print "The command has been canceled.\n";
        }

print "\nDone.\n\n";

							Good luck,
							Jaime

-- 
"[A]s we enjoy great advantages from the inventions of others, we should
be glad of an opportunity to serve others by any invention of ours; and
this we should do freely and generously." -- Ben Franklin,
http://earlyamerica.com/lives/franklin/chapt10/index.html


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0106190714590.17792-100000>