Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Mass Subdomain Setup/Creation

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

  1. Freexxxmen

    Freexxxmen Member

    Jun 11, 2003
    Likes Received:
    Trophy Points:
    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 Support Ticket Number: Support Ticket Number: Support Ticket Number:
  2. Freexxxmen

    Freexxxmen Member

    Jun 11, 2003
    Likes Received:
    Trophy Points:
    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 Support Ticket Number:
  3. asmithjr

    asmithjr Well-Known Member

    Jun 13, 2003
    Likes Received:
    Trophy Points:
    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.

    # 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
    cp $HTTPD /tmp/httpd.conf                       # Make a backup copy                             # Our Master Domain
    DOMIANHOME=domainhomedir                             # Home Directory Name
    NAME=$1                                         # take the argument
    if [ $NAME ]
    echo "<VirtualHost>
    BytesLog domlogs/$NAME.$
    ServerName $NAME.$
    ServerAdmin wwwadmin@$
    DocumentRoot /home/$DOMAINHOME/public_html/$NAME
    CustomLog domlogs/$NAME.$ combined
    User ptsamail
    Group ptsamail
    " >> $HTTPD
    # Now do the DNS record
    echo "$NAME     14400   IN      A" >> /var/named/$DOMAIN.db
    # Restart Apache and named
    /etc/init.d/httpd restart
    /etc/init.d/named restart
            echo "Usage: addsubdomain subname "
    # End
    # Support Ticket Number: Support Ticket Number:
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice