Automatic Subdomain Creation...

dilitalo

Member
Jan 16, 2007
12
0
151
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
 

AlexV.

Well-Known Member
Jun 15, 2006
212
1
168
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.
 

dilitalo

Member
Jan 16, 2007
12
0
151
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....
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
Hey, did you ever figure this issue out? We have similar needs for this.
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