Welcome to Geeklog, Anonymous Tuesday, April 16 2024 @ 01:13 am EDT

Geeklog Forums

Check Quota block

Status: offline


Forum User
Registered: 09/23/03
Posts: 7
I have written a little block to check that you are not overquota. I think it will only work on linux/unix systems that have a quota command, that formats the result in a standard way.

It will list your used space, quota, and freespace. As the freespace is less than $worry, $panic, and 0 it will write the freespace bigger and redder.

I don't know how useful it is, but hey

Put this code in lib_custom . Then in put 'phpblock_checkQuota' in the PHPblock section of the block, and hopefully it will work.

You will probably want to change $hd to the hard drive you are using (without /dev/) and change $worry, and $panic

Text Formatted Code
* Check quota()
* Php function to tell you if you are going overquota
* Will probably only work on unix systems

function phpblock_checkQuota(){
//      The hard disk you are interested in
//      when the free space should be in red
//      when the free space should be in red and large

        $return.= "<tr><td>used</td><td align=right>$matches[1] kB</td></tr>
        <tr><td>quota</td><td align=right>$matches[2] kB</td></td>";

                $return.= "<tr><td><b>Free</></td><td align=right><b><font color=red size=6>$freespace</font></b> kB</td></tr>";}
                $return.= "<tr><td><b>Free</b></td><td align=right><font color=red>$freespace kB</font></td></tr>";}
                $return.= "<tr><td><b>Free</b></td><td align=right><font color=red>$freespace kB</font></td></tr>
                                <tr><b>Grace</b></td><td align=right><font color=red>$matches[4]</font></td></tr>";

                $return.= "<tr><td><b>Free</b></td><td align=right>$freespace kB</td></tr>";
        return $return;


All times are EDT. The time is now 01:13 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content