Hooks in account transfer process?

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
948
29
178
Hi, I'm not a developer so please forgive my ignorance here. I understand that cpanel has "hooks" that allow you to run scripts before or after certain processes are run.

For example, when a new account is created on a cpanel server, you might want to identify the domain and add it to an external mail server so that mail could be sent into the cpanel server for that domain via the MTA.

So I guess you'd use the postwwwacct hook to run a script that would do the above job. Great!

When an account is copied to another server - it stands to reason that whatever script you ran via the hook you used in the postwwwacct process, you'd probably want to run again. So using the example above, if you move a domain from one server to another, it is reasonable to presume that you might want to update that information automatically on your external Mail MTA in order to make sure mail is delivered to the correct place.

Can you please tell me if there are "hooks" available to do that?

Many thanks.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,270
463
Hello :)

The following document may be of help to you:

cPanel - Standardized Hooks

Note that when transferring an account, the account is created on the destination server, so any post account creation hooks should automatically apply when the account is transferred.

Thank you.
 

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
948
29
178
Hello :)

The following document may be of help to you:

cPanel - Standardized Hooks

Note that when transferring an account, the account is created on the destination server, so any post account creation hooks should automatically apply when the account is transferred.

Thank you.
Hi Michael, thanks for the link.

Can you confirm 100% that the same postwwwacct hook applies to the creation of the account when using the transfer account process? Perhaps this is also the same for a "restore full backup" too?
 

vanessa

Well-Known Member
PartnerNOC
Sep 26, 2006
959
76
178
Virginia Beach, VA
cPanel Access Level
DataCenter Provider
When accounts are transferred, wwwacct is called to create the account before the data is restored. So yes, the same hook applies. We use it on our servers all the time.

Not sure about the restorepkgacct one - the docs seem to imply that this isn't the case.
 

4u123

Well-Known Member
PartnerNOC
Jan 2, 2006
948
29
178
When accounts are transferred, wwwacct is called to create the account before the data is restored. So yes, the same hook applies. We use it on our servers all the time.

Not sure about the restorepkgacct one - the docs seem to imply that this isn't the case.
Thanks, that's what I needed to know.