The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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:
    157
    Likes Received:
    0
    Trophy Points:
    16
    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.
     
  2. lakridserne

    lakridserne Member

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

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    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
     
  4. beddo

    beddo Well-Known Member

    Joined:
    Jan 19, 2007
    Messages:
    157
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    England
    cPanel Access Level:
    DataCenter Provider
    That's great I can easily extract the information needed from that. Thanks very much.
     
Loading...

Share This Page