[sork] Accounts/quota
Eric Rostetter
eric.rostetter at physics.utexas.edu
Sat Aug 2 22:00:16 PDT 2003
Quoting MiikaT <mlist.horde2 at finansium.fi>:
> Quoting Eric Rostetter <eric.rostetter at physics.utexas.edu>:
> > Maybe change $homedir to match on whitespace seperated digits, ala:
> >
> > $homedir = "(\w+[0-9\*]+)+";
> >
> > And then set the grep path to point to "egrep" instead "grep" (e.g.
> > $conf['server']['params']['grep_path'] = '/bin/egrep';
>
> No errors with this configuration, neither do I have quota info when enabled
> or disabled :-(
Hmmm. I'd expect an error actually. I would guess it is due to the following.
The lines which read (or are similar to):
$splitted = split("[[:blank:]]+", trim($quota_data[0]));
$used = $splitted[1] / 1000 ; $quota = $splitted[2] / 1000 ;
$percent = $used * 100 / $quota ;
$exceeded = strpos($splitted[1], "*") ? "EXCEEDED!":"";
Splits the columns by spaces. It assumes the first field is the device, but
in your example there is no device on that line (since it wrapped onto two
lines). Hence all the indexes would be off by one.
So, you would want to edit the file(s) and decrement the indexes for
$splitted[] by one. Something like:
$splitted = split("[[:blank:]]+", trim($quota_data[0]));
$used = $splitted[0] / 1000 ; $quota = $splitted[1] / 1000 ;
$percent = $used * 100 / $quota ;
$exceeded = strpos($splitted[0], "*") ? "EXCEEDED!":"";
And *maybe* that will work; again I've not tested any of this...
I don't have time to work on any of this now, but if I ever do (or if any one
else does) we should try to find a way to handle the quota info being split
over two lines in a more graceful and standard way...
I suppose the real problem here is this is really just a hack in the first
place. What we really need is better way to get the quota info rather than
grep'ing the output of a shell command.
> -MiikaT
--
Eric Rostetter
The Department of Physics
The University of Texas at Austin
Why get even? Get odd!
More information about the sork
mailing list