Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    cPanel Verified Vendor This forum account has been confirmed by cPanel staff to represent a vendor.
    Join Date
    Sep 2007
    Posts
    96

    Default 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. :\
    Last edited by blargman; 11-13-2009 at 05:49 PM.

  2. #2
    cPanel Verified Vendor This forum account has been confirmed by cPanel staff to represent a vendor.
    Join Date
    Sep 2007
    Posts
    96

    Default

    I should note evidently it works fine on release but not current. Which I need unfortunately for the 11.25 xml-api functions.

  3. #3
    cPanel Verified Vendor This forum account has been confirmed by cPanel staff to represent a vendor.
    Join Date
    Sep 2007
    Posts
    96

    Default

    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. #4
    cPanel Verified Vendor This forum account has been confirmed by cPanel staff to represent a vendor.
    Join Date
    Sep 2007
    Posts
    96

    Default

    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. #5
    Member
    Join Date
    Mar 2007
    Posts
    35

    Default

    Quote Originally Posted by blargman View Post
    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. :\
    do you only put that simple code on deladdondomain file or is there anything else you had add ?

  6. #6
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    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
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

Similar Threads & Tags
Similar threads

  1. DNS Hooks
    By tier2 in forum cPanel Developers
    Replies: 2
    Last Post: 01-01-2011, 11:03 AM
  2. cPanel Hooks
    By mynameanu in forum cPanel Developers
    Replies: 5
    Last Post: 09-26-2010, 08:04 AM
  3. EasyApache Hooks
    By VeZoZ in forum cPanel Developers
    Replies: 2
    Last Post: 01-16-2010, 02:49 PM
  4. hooks for subdomains
    By apogee in forum cPanel Developers
    Replies: 0
    Last Post: 10-01-2009, 07:35 AM
  5. WHM Hooks help
    By Snoopy in forum New User Questions
    Replies: 2
    Last Post: 11-05-2007, 01:15 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube