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!

Get reseller account from script

Discussion in 'cPanel Developers' started by beddo, May 23, 2011.

  1. beddo

    beddo Well-Known Member

    Joined:
    Jan 19, 2007
    Messages:
    161
    Likes Received:
    1
    Trophy Points:
    168
    Location:
    England
    cPanel Access Level:
    DataCenter Provider
    Hi folks,

    At the moment, cpbackup dumps all the user accounts into one directory.

    What I would like to do is run a script that can separate the tarballs into a directory for each reseller. I'm not a novice at writing scripts so I can handle all the file operations myself. Unfortunately I have no idea how to call into cpanel from a script. I just need a simple command that I can run that takes one parameter as input (a username) and provides one variable as output (the reseller username).

    I am aware it will need to take into account things like cleaning up the old tar balls myself as they will no longer be where cpanel can see them to rotate them.

    Can anyone point me in the right direction?

    Cheers.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. lakridserne

    lakridserne Member

    Joined:
    Dec 3, 2009
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    126
    As far as I know you should be able to use the API to get it.
     
  3. cPanelDavidN

    cPanelDavidN Integration Developer

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    3
    Trophy Points:
    68
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi beddo,

    For local scripting purposes, you can get that info from /etc/trueuserowners or in the user's individual cpuser file (/var/cpanel/users/$cpuser). For remote purposes, you can use the special API1 "print" module, as discussed here and request the $CPDATA{'OWNER'} value.

    Regards,
    -DavidN
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. beddo

    beddo Well-Known Member

    Joined:
    Jan 19, 2007
    Messages:
    161
    Likes Received:
    1
    Trophy Points:
    168
    Location:
    England
    cPanel Access Level:
    DataCenter Provider
    That's great I can easily extract the information needed from that. Thanks very much.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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