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.

How to use hooks?

Discussion in 'cPanel Developers' started by blargman, Nov 13, 2009.

  1. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    Hooks in cpanel/hooks not running

    Could anyone clarfiy this for me? I am going to do some more testing on it but I was under the impression I could hook into cpanel and run arbitrary commands on certain actions.

    I created /usr/local/cpanel/hooks/addondomain
    then created a file inside it /usr/local/cpanel/hooks/addondomain/deladdondomain

    It's a simple python script
    #!/usr/local/bin/python
    f=open('/root/test.txt', "w")
    f.write('This is a test\n')
    f.close

    I thought this should run any time I delete an addondomain but it doesn't appear to be. I've checked everything obvious permisisons, execute bit etc. Am I just not doing this right at all?
    I did forget to run registerhooks. I just did that though and not much more help. If I run the script manually it works fine. :\
     
    #1 blargman, Nov 13, 2009
    Last edited: Nov 13, 2009
  2. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    I should note evidently it works fine on release but not current. Which I need unfortunately for the 11.25 xml-api functions.
     
  3. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    I can get addondomain/deladdondomain to work on another 11.25 machine , so there must be something screwy with my VPS I'm testing with.
     
  4. blargman

    blargman Well-Known Member

    Joined:
    Sep 11, 2007
    Messages:
    99
    Likes Received:
    0
    Trophy Points:
    6
    well I mv /usr/local/cpanel /usr/local/cpanel.bak && /scripts/upcp as there waas no reason i could think of to explain this and the logs weren't helping. This fixed it. We'll see what else this sledgehammer approach broke in the process :)
     
  5. nsetiono

    nsetiono Active Member

    Joined:
    Mar 29, 2007
    Messages:
    36
    Likes Received:
    0
    Trophy Points:
    6
    do you only put that simple code on deladdondomain file or is there anything else you had add ?
     
  6. 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
    What version of cPanel are you running?

    If you are running 11.25.0 you will need to execute /usr/local/cpanel/bin/register_hooks

    If you have CustomEventHandler in place, this may break usage with hooks.

    Is your script actually executable?

    Does anything come up in the error_log when this happens
     
Loading...

Share This Page