Parking a domain after account creation

Silent Ninja

Well-Known Member
Apr 18, 2006
196
0
166
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 !!!!!!!!!!!!!")
 
Last edited:

Silent Ninja

Well-Known Member
Apr 18, 2006
196
0
166
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
 

KostonConsulting

Well-Known Member
Verifed Vendor
Jun 17, 2010
255
1
68
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
 

Silent Ninja

Well-Known Member
Apr 18, 2006
196
0
166
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 ?
 

KostonConsulting

Well-Known Member
Verifed Vendor
Jun 17, 2010
255
1
68
San Francisco, CA
cPanel Access Level
Root Administrator
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 ?
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)