Go Back   HostGator Peer Support Forums > HostGator Peer Support Forums > Linux VPS Support

Notices

Reply
 
Thread Tools
  #1  
Old 07-06-2010, 10:58 AM
sorathia sorathia is offline
Hatchling Croc
 
Join Date: Jun 2010
Posts: 22
Default Creating subdomains from command line

Anyone know how to create subdomains from the command line? I know how to do it from cpanel, but I'm trying to script out my setup process.

I've updated the following files and the sub-domain does not come up on the browser....

/etc/httpd/conf/httpd.conf
/var/named/mydomain.com.db
/etc/localdomains
/etc/userdomains

Am I missing any other files?

Thanks,
Neil
Reply With Quote
  #2  
Old 07-06-2010, 11:55 AM
GatorBClemmer's Avatar
GatorBClemmer GatorBClemmer is offline
HostGator Staff
 
Join Date: Apr 2009
Posts: 227
Default Re: Creating subdomains from command line

There are also the cPanel user file and the cPanel user meta file
/var/cpanel/users/USERNAME
/var/cpanel/userdata/USERNAME/subdomain.file

There are a number of advantages to not editing the apache configuration file as your changes will probably get overwritten during an update.
cPanel/WHM builds that configuration file from various metadata files that should be edited instead.

If you are looking to script the creation of subdomains, I suggest using the cPanel API. More information on the addsubdomain function can be found here:
http://docs.cpanel.net/twiki/bin/vie...n_addsubdomain

There are also a few php scripts set up to perform this same thing that have been passed around on the cPanel forums.
Reply With Quote
  #3  
Old 07-06-2010, 12:10 PM
sorathia sorathia is offline
Hatchling Croc
 
Join Date: Jun 2010
Posts: 22
Default Re: Creating subdomains from command line

Thanks GatorBClemmer!

If anyone has already written a script to create a sub-domains, could you please email it to me? I would really appreciate it! Thanks
Reply With Quote
  #4  
Old 07-06-2010, 12:53 PM
quietFinn's Avatar
quietFinn quietFinn is offline
Veteran Croc
 
Join Date: Feb 2005
Posts: 3,557
Default Re: Creating subdomains from command line

Searched in the cPanel forums and found this:
http://www.zubrag.com/scripts/cpanel...ns-creator.php
__________________
quietFinn - netFinn Finland
"Be who you are and say what you feel because those who mind don't matter and those who matter don't mind." - Dr. Seuss
Reply With Quote
  #5  
Old 07-06-2010, 01:17 PM
sorathia sorathia is offline
Hatchling Croc
 
Join Date: Jun 2010
Posts: 22
Default Re: Creating subdomains from command line

Perfect Thanks!
I'll modify the script as needed...
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron and command line help!! Please!! duetime Shared Hosting Support 3 06-17-2009 01:08 PM
Java command line gemal Shared Hosting Support 0 06-26-2008 09:46 AM
Can I use cpan from the command line? gaarai Shared Hosting Support 2 07-07-2007 05:27 PM
Creating MySQL Databases from the command line - permission denied patwa Shared Hosting Support 5 06-29-2007 05:20 PM

All times are GMT -5. The time now is 01:05 PM.