cPanel event not triggering the execution of my script. Am I doing it wrong?
Hi,
I'm using the manage_hooks script to hook into some MySQL related events like Mysql::create_user and Mysql::delete_user among others. Here's the one-liner I'm running:
The run confirms the hook has been registered:
Unfortunately these events are not triggering my script (script syncup.sh is executable with the executable bit set for the directories as well). Is this the right way to hook into these events and trigger a script run? Thank you
/usr/local/cpanel/bin/manage_hooks add script /home/scripts/syncup.sh --category Cpanel --event 'Mysql::create_user' --stage post --manual 1The run confirms the hook has been registered:
Added hook for Cpanel::Mysql::create_user to hooks registryUnfortunately these events are not triggering my script (script syncup.sh is executable with the executable bit set for the directories as well). Is this the right way to hook into these events and trigger a script run? Thank you
-
Hi @stards , For Cpanel events, you have to specify the API system in addition to the module/function, API::Module::function
. For your case, this would beUAPI::Mysql::create_user
. Additionally, you can turn on Standardized Hooks - Debug Mode in WHM >> Tweak Settings, then call the API using the CLI commands. As part of the return, if a hook is registered to the API event, it will list pre- and post- conditions with any hooks registered for it.0 -
Hi @stards , For Cpanel events, you have to specify the API system in addition to the module/function,
API::Module::function
. For your case, this would beUAPI::Mysql::create_user
. Additionally, you can turn on Standardized Hooks - Debug Mode in WHM >> Tweak Settings, then call the API using the CLI commands. As part of the return, if a hook is registered to the API event, it will list pre- and post- conditions with any hooks registered for it.
Very helpful! Thanks TJ.0
Please sign in to leave a comment.
Comments
2 comments