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.

Hooks in account transfer process?

Discussion in 'cPanel Developers' started by 4u123, Feb 6, 2014.

  1. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    653
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    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.
     
  3. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    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?
     
  4. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    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.
     
  5. 4u123

    4u123 Well-Known Member
    PartnerNOC

    Joined:
    Jan 2, 2006
    Messages:
    765
    Likes Received:
    1
    Trophy Points:
    18
    Thanks, that's what I needed to know.
     
Loading...

Share This Page