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.

Script to create subdomains/parked domains

Discussion in 'General Discussion' started by garlic, Mar 22, 2007.

  1. garlic

    garlic Registered

    Joined:
    Feb 25, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I am currently writing a "web service" like collection of scripts to act as a wrapper around cpanel to enable cpanel like functionality within the content manager that we sell.

    Basically we are trying to include the most used functionality into these scripts. These scripts are served by the cpanel webserver, so they have the same permissions as the user frontend.

    My question is this, what application does the cpanel user frontend use to create subdomains and parked domains?

    My best guess is the /usr/local/cpanel/bin/domainadmin application, but I can't seem to find its usage anywhere.

    I was able to very easily replicate the add/delete/edit email account type functions thanks to the /usr/local/cpanel/cpanel-email application. I am hoping there is a similar one for domains!

    I really don't want to try and replicate this process... setting up apache virt hosts, email accounts, dns records, ftp accounts etc... ergh.

    Any help welcome,

    Thanks,

    Michael
     
  2. cmdln

    cmdln Active Member

    Joined:
    Mar 17, 2007
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    where did you find the usage for /usr/local/cpanel/cpanel-email ?
     
  3. Frimon86

    Frimon86 BANNED

    Joined:
    Jun 4, 2007
    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    0
    Have you tried getting a billing system? Try http://www.modernbill.com
    If you can configure it properly regarding their FAQ then you can get automated accounts and things like that.
     
  4. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider

    echo "[UID] ADD [SUB] [DOMAIN] [TURN OFF CAN NAME] [DIR]" | /usr/local/cpanel/bin/domainadmin
    [UID] = unix uid of user to add domain to
    [SUB] = subdomain portion of the domain ==>bob<===.cpanel.net
    [DOMAIN] non sub portion bob.==>cpanel.net<==
    [TURN OFF CAN NAME] = 0 for subdomains, 1 for addon domains
    [DIR] = /home/USER/public_html/bob


    echo "[UID] ADD [DOMAIN] [TOPDOMAIN]" | /usr/local/cpanel/bin/parkadmin
    [UID] = unix uid of user to add domain to
    [DOMAIN] = parked domain
    [TOPDOMAIN] = domain to park on
     
  5. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    You could also use the AdminBin Lib


    use Cpanel::AdminBin ();

    my $res = Cpanel::AdminBin::adminrun( 'park', 'ADD', $domain, $topdomain );
    if ( !$Cpanel::CPERROR{'park'} ) {
    return ( 1, $res );
    }
    else {
    return ( 0, $Cpanel::CPERROR{'park'} );
    }
     
  6. cmdln

    cmdln Active Member

    Joined:
    Mar 17, 2007
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    I dont want a billing system. I just want to be able to script some processes. One of the processes I would like to script is creation/deletion of email forwards. I would also like to script email creation .... however i can find examples of email creation. I just cant seem to find usage for the cpanel-email script.
     
  7. cPanelNick

    cPanelNick Administrator
    Staff Member

    Joined:
    Mar 9, 2015
    Messages:
    3,426
    Likes Received:
    2
    Trophy Points:
    38
    cPanel Access Level:
    DataCenter Provider
    cpanel-email: usage
    addpop <popuser> <password> <quota> <domain>
    passwdpop <popuser> <password> <quota> <domain>
    delpop <popuser> 0 <domain>
    editquota <popuser> <domain> <quota>
    listlists
    addlist <listname> <password> <domain> <rebuildonly>
     
  8. cmdln

    cmdln Active Member

    Joined:
    Mar 17, 2007
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    So I cannot add a forwarder with cpanel-email then?
     
  9. cmdln

    cmdln Active Member

    Joined:
    Mar 17, 2007
    Messages:
    27
    Likes Received:
    0
    Trophy Points:
    1
    nothing from that seems to work at all.
    I never get any output even from listlists.
    When i create a user like so /usr/local/cpanel/cpanel-email testuser password 0 domain.tld
    nothing shows up in the web interface. If i create a user in the webinterface I cant delete the email user from the commandline with delpop either.

    [edit]
    After reading /scripts/addpop i see that it was using the user env variable so after changing to the domain user and trying again it seems to work.
     
    #9 cmdln, Jul 18, 2007
    Last edited: Jul 18, 2007
Loading...

Share This Page