Free Disk Space status w/o logging in to Web Panel

software development

#1

If you SSH to your Dreamhost webserver and run the ‘df’ command, you cannot get the actual free disk space for your disk quota at Dreamhost. Instead, you have to login to the Web Panel and manually lookup the disk space usage.

This is a set of PHP scripts that will automate all this. This is what it does:

  1. Use CURL to act like a web browser: goto login page; login; request status after login. It saves a cookie file to perform these steps and deletes the cookie when finished.
  2. The response is formatted as JSON. And the version of PHP is 4.x, which doesn’t support JSON.
  3. Use the included json.php file to convert the JSON into a PHP object variable. This file is from here: http://pear.php.net/pepr/pepr-proposal-show.php?id=198

To avoid markup problems, the code is posted here: http://www.tlsincubator.com/free_disk_space.html


#2

Very nice!

By the way, while in SSH you can type quota for some quick info.

Returns blocks - knocking off 6 digits gives approx GB :wink:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost