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.

custom event handler

Discussion in 'cPanel Developers' started by sirdopes, Mar 11, 2011.

  1. sirdopes

    sirdopes Well-Known Member
    PartnerNOC

    Joined:
    Sep 25, 2007
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    16
    Is there a way to modify the userdata file for a domain using the CustomEventHandler? I am trying to update the file after I add an addon domain. I tried calling Cpanel::Config::userdata::update_domain_datafield directly but I get permission denied since it is running as the cpanel user.
     
  2. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Well, you have a few different options here.

    This code does require escalated privileges so you can use the AdminBin/AdminRun system to execute whatever you want.

    You can also use the function hooks system to do this - these are already executed as root, but do not offer quite as much flexibilty as the CustomEventHandler system.

    There is another option, bring it up with me tomorrow.
     
  3. sirdopes

    sirdopes Well-Known Member
    PartnerNOC

    Joined:
    Sep 25, 2007
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    16
    The function hooks look like they would work for what I am doing. Does it need to be all lower case or does the case need to be set? Right now, I just am trying to touch a file in /tmp/ when I add an addon domain. It looks like it is seeing the file and I don't have any errors in the error_log but do not see the file being touched.

    /usr/local/cpanel/bin/register_hooks
    Registered hook addondomain::addaddondomain
    Registered 1 hooks
     
  4. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi sirdopes,

    It may sound silly, but your hook script does have the executable bit set, right?

    Regards,
    -DavidN
     
Loading...

Share This Page