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.

Parking a domain after account creation

Discussion in 'cPanel Developers' started by Silent Ninja, Jan 10, 2012.

  1. Silent Ninja

    Silent Ninja Well-Known Member

    Joined:
    Apr 18, 2006
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Buenos Aires, Argentina
    I need to create a script to park a domain like this on each new account:

    $cpaneluser.`hostname` (ie. user.server.example.com) => parked to the www domain

    So the users can access there as if it was their "alternate domain" (ie, if their dns's fail, or if they want to try the service before pointing their actual domains).

    I know I can do it with the /scripts/postwwwacct hook, but I haven't found any way to park a domain using bash. So I'm parking it manually for now.

    How can I park the domain automatically for it to work?

    PS EDIT: I've found /scripts/park but I'm not using it since it claims that it shouldn't be used ("!!!!!!!!!!!!! This script is deprecated and will be removed in future builds !!!!!!!!!!!!!")
     
    #1 Silent Ninja, Jan 10, 2012
    Last edited: Jan 10, 2012
  2. Silent Ninja

    Silent Ninja Well-Known Member

    Joined:
    Apr 18, 2006
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Buenos Aires, Argentina
    Recalling this thread, I've found this link http://forums.cpanel.net/f42/cpanel-api-1-2-parked-domain-hooks-125393.html which had some information about what I wanted, but the script just doesn't exist anymore on newer cPanel releases, there's onle these ones:

    /usr/local/cpanel/hooks/park/listaddondomains.example
    /usr/local/cpanel/hooks/park/listparkeddomains.example

    And also, both are empty files.

    Do you have any ideas on where are these scripts now?

    PS: I have cPanel RELEASE 11.30.5 (build 3) which should be the last version available
     
  3. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    You'll need to create those files (they can contain whatever scripts you want (PHP, Perl, Bash)) and then add them to the registered cPanel hooks using: /usr/local/cpanel/bin/register_hooks

    You may want to look at the new cPanel hooks system as /usr/local/cpanel/hooks only allows for one hook per function which could conflict with a plugin or future hook you may want to add:

    Basic Usage | Standardized Hooks
     
  4. Silent Ninja

    Silent Ninja Well-Known Member

    Joined:
    Apr 18, 2006
    Messages:
    198
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Buenos Aires, Argentina
    Ok, that seems to be what I was looking for, but I was hoping for a more easy way to learn, since...

    On every account creation, I should take the domain and user account that's being created, park the domain user[dot]`hostname` on top to show the same as the user's domain

    ... but how ?
     
  5. KostonConsulting

    KostonConsulting Well-Known Member

    Joined:
    Jun 17, 2010
    Messages:
    255
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    San Francisco, CA
    cPanel Access Level:
    Root Administrator
    You'll need to know how to code to do that but you can learn if needed. Take the data you get in from the hook and call the cPanel API to park the domain:

    ApiPark < ApiDocs/Api2 < TWiki

    Your option on how to call the API:

    XML/JSON via HTTP: cPanel XML and JSON APIs

    Perl Library: (see /usr/local/cpanel/Cpanel/XML.pm)
     
Loading...

Share This Page