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.

Mass Subdomain Setup/Creation

Discussion in 'General Discussion' started by Freexxxmen, Oct 3, 2003.

  1. Freexxxmen

    Freexxxmen Member

    Joined:
    Jun 11, 2003
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Im trying to figure out a way to either write a backend perl script or setup a page in the Subdomians section of X skin ...

    To do aline by line loop or a mass creation of subdomains. I cant find where the function addsubdomian is stored in cpanel tho so i can see what all it does.

    And figure out the best way to do this. Essintialy I have a list of subdomains id like to setup on serveral domains 50 or so....

    And i dont wanna add each one one by one ... 50subsx10domains... This adds up QUICKLY any help ois appriciated

    cPanel.net Support Ticket Number:

    cPanel.net Support Ticket Number:

    cPanel.net Support Ticket Number:
     
  2. Freexxxmen

    Freexxxmen Member

    Joined:
    Jun 11, 2003
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Does no one know where the subrountine addsubdomain is stored at... or know the systax needed to doa locaton: type command so i can loop it in a foreach to add all the subdomains i need to add

    cPanel.net Support Ticket Number:
     
  3. asmithjr

    asmithjr Well-Known Member

    Joined:
    Jun 13, 2003
    Messages:
    475
    Likes Received:
    1
    Trophy Points:
    18
    script to add a subdomain

    I got tired to looking and was not able to find anything. I needed a way to add a subdomain from the command line.

    This script as written takes an argument to create the sub domain. The argument is the "sub" domain name. It creates the record for Apache and the DNS then restarts the httpd and named.

    The script does not as written create the sub directory. That could be easily accomplished.

    Code:
    #!/bin/sh
    
    # addsubdomain.sh
    # Al Smith 10-05-2003
    # This shell will add a subdomain record for the httpd.conf and
    # create the DNS record then restart apache and the named
    
    HTTPD=/usr/local/apache/conf/httpd.conf
    cp $HTTPD /tmp/httpd.conf                       # Make a backup copy
    DOMAIN=yourdomain.com                             # Our Master Domain
    DOMIANHOME=domainhomedir                             # Home Directory Name
    
    NAME=$1                                         # take the argument
    if [ $NAME ]
    then
    
    echo "<VirtualHost 69.41.238.251>
    BytesLog domlogs/$NAME.$DOMAIN.com-bytes_log
    ServerName $NAME.$DOMAIN.com
    ServerAdmin wwwadmin@$DOMAIN.com
    DocumentRoot /home/$DOMAINHOME/public_html/$NAME
    CustomLog domlogs/$NAME.$DOMAIN.com combined
    User ptsamail
    Group ptsamail
    </VirtualHost>
    " >> $HTTPD
    
    # Now do the DNS record
    echo "$NAME     14400   IN      A       69.41.238.251" >> /var/named/$DOMAIN.db
    
    # Restart Apache and named
    /etc/init.d/httpd restart
    /etc/init.d/named restart
    
    else
            echo "Usage: addsubdomain subname "
    fi
    
    #
    # End
    #
    
    cPanel.net Support Ticket Number:

    cPanel.net Support Ticket Number:
     
Loading...

Share This Page