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.

Automatic Subdomain Creation...

Discussion in 'General Discussion' started by dilitalo, Oct 26, 2007.

  1. dilitalo

    dilitalo Member

    Joined:
    Jan 16, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Hi, i am looking to automatically create subdomains for each new account that we setup.

    Example: after a new account is created we would like a subdomain ex: program.domain.com to be automatically created, that links to a specific software on the server ex: /opt/program .

    Any help on this issue is appreciated.

    Thank you in advance
     
  2. AlexV.

    AlexV. Well-Known Member

    Joined:
    Jun 15, 2006
    Messages:
    212
    Likes Received:
    1
    Trophy Points:
    16
    You can take advantage of the cPanel hooks:

    http://www.cpanel.net/support/docs/hooks.htm


    This one in particular should help you accomplish the intended behavior:

    /scripts/postwwwacct
    This script will be run after an account is created. Within this script, data from /scripts/wwwacct can be accessed so that it can be passed to something such as a billing solution, custom application, or script.
     
  3. dilitalo

    dilitalo Member

    Joined:
    Jan 16, 2007
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    Ok i know where to input the code, just i need the actual functions.

    First I want to run a command as in SSH: ln -s /opt/program /home/USERNAME/public_html/program

    And then I need the actual code that would create the subdomain.

    Any help is appreciated....
     
  4. parachat

    parachat Registered

    Joined:
    Aug 12, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Hey, did you ever figure this issue out? We have similar needs for this.
     
  5. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    You can use API1 code via the XML-API to create the subdomain automatically.

    You can find this API call in /usr/local/cpanel/base/frontend/x3/subdomain/doadddomain.html and the documentation for how to call it from the XML API at:

    http://www.cpanel.net/plugins/xmlapi
     
  6. parachat

    parachat Registered

    Joined:
    Aug 12, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Do you know if we could easily enable this option through ModernBill v4?
     
Loading...

Share This Page