Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Getting Backup diskspace value

Discussion in 'cPanel Developers' started by ebuka, Jul 11, 2019.

  1. ebuka

    ebuka Member

    Joined:
    Oct 26, 2018
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Nigeria
    cPanel Access Level:
    Root Administrator
    Good Day happy people.
    Please I have been trying to get the server backup-disk space from a cpanel account with the below php code, but I keep getting error:
    code:
    $df = disk_free_space("/backup");
    echo $df;

    Error:
    PHP Warning: disk_free_space(): No such file or directory in /home/username/public_html/test.php on line 137

    I have added the cpanel user to the root group(I have root previlage ), the "/backup" drive permission is 0771 and the user can execute exec() command.

    Kindly help.
     
  2. nixuser

    nixuser Well-Known Member

    Joined:
    May 30, 2014
    Messages:
    135
    Likes Received:
    30
    Trophy Points:
    28
    cPanel Access Level:
    Root Administrator
    Twitter:
    /backup directory exists on server?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. ebuka

    ebuka Member

    Joined:
    Oct 26, 2018
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Nigeria
    cPanel Access Level:
    Root Administrator
    Yes Sir, it does
     
  4. nixuser

    nixuser Well-Known Member

    Joined:
    May 30, 2014
    Messages:
    135
    Likes Received:
    30
    Trophy Points:
    28
    cPanel Access Level:
    Root Administrator
    Twitter:
    The message indicates otherwise. Will the code (only for the diskspace) work if placed in a different file?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,588
    Likes Received:
    2,182
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @ebuka,

    This is not a recommended action due to the negative security impact.

    Can you provide some more background information about the need for this functionality? Particularly, what's the use case for providing the cPanel user with the ability to see how much space is available on the /backup partition?

    Note the following UAPI function is available to obtain account-specific resource usage:

    UAPI Functions - ResourceUsage::get_usages - Developer Documentation - cPanel Documentation

    Thank you.
     
  6. ebuka

    ebuka Member

    Joined:
    Oct 26, 2018
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Nigeria
    cPanel Access Level:
    Root Administrator
    Thanks for your response.
    Yes the code works for "/" directory or "/home" which is where the user account resides.
    Thanks.
     
  7. ebuka

    ebuka Member

    Joined:
    Oct 26, 2018
    Messages:
    11
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Nigeria
    cPanel Access Level:
    Root Administrator
    Thanks for your response.
    We have several severs that their backup diskspace fills-up easily due to their size. The management is not ready to upgrade the backup diskspace, so most time we only get to know the disk is filled-up when we try to restore an account from back-up and a diskspace error comes up. In essence, I want to get the backup disk value s from all our servers and display all of them on a single page.

    P.S Thanks for the UAPI function reference, but my focus is on the backup disk value for the whole server not users.
     
  8. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,588
    Likes Received:
    2,182
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice