[imp] IMAP Quota Redhat 7.3 extra code

Eric Rostetter eric.rostetter@physics.utexas.edu
Mon, 3 Jun 2002 21:30:58 -0500


Quoting "Hanser, Kevin" <kevin@merchantinternetgroup.com>:

> I just tried this code on my IMP installation, and I'm getting a weird
> error..

I hadn't noticed how much Arie had changed of my code.  I'll try to get it
fixed up on the site asap.
 
> The bar shows, but it's all light blue (none filled), and I get a message of
> "Quota not available" instead of "quota on ..."

Either your quotas are not available, or you aren't getting the quota
data back and parsed correctly from the exec() call.
  
>         $junk = exec("sudo /usr/bin/quota -u $imap_admin | grep /dev/hda2",
>                      $quota_data,$return_code);

What happens if you manually login as an sudo authorized user and do:

sudo /usr/bin/quota -u $USER

and 

sudo /usr/bin/quota -u $USER | grep /dev/hda2

If you don't get proper output from these, then nothing else will work.

>         if ($return_code == 0 && count($quota_data) == 1) {

Obviously you didn't meet these requirements, so you fall through
to the "else"

>         } else {
>             $quota_html .= '<td align="center" class="header">';
>             $quota_html .= "Quota not available";
>         }

There's the message. Then:

        $quota_html .= '<table width="100%"><tr><td bgcolor="#ccccff"><div
> style="height:6px; width:'. sprintf("%.1f%%", $percent). '; font-size:3px;
> background-color:'.$color.'">';

But the variables are not defined as they were only defined in the "if"
statement (true branch) and you took the "else" false branch.
 
> Any help would be appreciated.  The screenshots of this look great, I can't
> wait to get it working on my system :)
>  
> k

First, try the above sudo commands by hand and see what happens.  If they
don't work, then the rest can't work.  In the mean time I'll try to clean
up the code some more...

Arie, you'll welcome to help and/or clean up the code also.
  
-- 
Eric Rostetter
The Department of Physics
The University of Texas at Austin

"TAD (Technology Attachment Disorder) is an unshakable, impractical devotion
to a brand, platform, product line, or programming language. It's relatively
harmless among the rank and file, but when management is afflicted the damage
can be measured in dollars. It's also contagious -- someone with sufficient
political clout can infect an entire organization."

--"Enterprise Strategies" columnist Tom Yager.