Hooks not executed
I'm using hooks to install and configure my apps in cPanel account. It worked great, but the hooks aren't working on 11.42 build 12 anymore. I'm not sure from which version it's broken.
/root/cpanel-deploy/mysqlAddDBHook contains some code to write credentials to a config file. For testing purposes I added the following:
I add the hooks with this command:
I set the debughooks property to 2 and the following output appears in /usr/local/cpanel/logs/error_log:
As you can see in error_log there's no output between Beginning and Finished. Even when I put some random characters in my script it won't show an error. Normally I get the something like this: "HOOK INFO: hook mysqlAddDBHook did not output any data" Does somebody have a solution for my problem? Kind regards Martijn
#!/bin/bash
echo "test"
read input
echo $inputI add the hooks with this command:
manage_hooks add script /root/cpanel-deploy/mysqlAddDBHook --event=Api1::Mysql::adddb --stage=post --category=Cpanel --manual --escalateprivsI set the debughooks property to 2 and the following output appears in /usr/local/cpanel/logs/error_log:
[2014-04-28 17:37:43 +0200] info [cpmysql] Creating MySQL database f20_test24 for user f20
[2014-04-28 17:37:43 +0200] info [cpanel] ---debug_hooks---
[2014-04-28 17:37:43 +0200] info [cpanel] msg: Beginning execution of script hook.
[2014-04-28 17:37:43 +0200] info [cpanel] context: Cpanel::Api1::Mysql::adddb
[2014-04-28 17:37:43 +0200] info [cpanel] stage: post
[2014-04-28 17:37:43 +0200] info [cpanel] point: main
[2014-04-28 17:37:43 +0200] info [cpanel] id: rLiWmcxBdMvkV11vEpLftFU8
[2014-04-28 17:37:43 +0200] info [cpanel] hook: /root/cpanel-deploy/mysqlAddDBHook
[2014-04-28 17:37:43 +0200] info [cpanel] escalateprivs: 1
[2014-04-28 17:37:43 +0200] info [cpanel] weight: 200
[2014-04-28 17:37:43 +0200] info [cpanel] data: {"user":"f20","output":[],"args":["test24">}
[2014-04-28 17:37:43 +0200] info [cpanel] ---debug_hooks---
[2014-04-28 17:37:43 +0200] info [cpanel] msg: Finished execution of script hook.
[2014-04-28 17:37:43 +0200] info [cpanel] context: Cpanel::Api1::Mysql::adddb
[2014-04-28 17:37:43 +0200] info [cpanel] stage: post
[2014-04-28 17:37:43 +0200] info [cpanel] result: 0
[2014-04-28 17:37:43 +0200] info [cpanel] point: main
[2014-04-28 17:37:43 +0200] info [cpanel] id: rLiWmcxBdMvkV11vEpLftFU8
[2014-04-28 17:37:43 +0200] info [cpanel] hook: /root/cpanel-deploy/mysqlAddDBHook
[2014-04-28 17:37:43 +0200] info [cpanel] escalateprivs: 1
[2014-04-28 17:37:43 +0200] info [cpanel] weight: 200
[2014-04-28 17:37:43 +0200] info [cpanel] data: {"user":"f20","output":[],"args":["test24">}As you can see in error_log there's no output between Beginning and Finished. Even when I put some random characters in my script it won't show an error. Normally I get the something like this: "HOOK INFO: hook mysqlAddDBHook did not output any data" Does somebody have a solution for my problem? Kind regards Martijn
-
Please ensure you open bug reports via: Submit A Bug Report You can post the ticket number here so we can update this thread with the outcome. Thank you. 0 -
I reported a bug with ID 4881345 I discovered that this problem only occurs with cPanel hooks not with WHM hooks. 0 -
To update, per the support ticket, the user has been advised to try using API2 because API1::Mysql is deprecated. Thank you. 0 -
The problem was resolved by setting the right permissions. root and cpanel-deploy must have execute permissions for everybody. Escalate privileges doesn't matter. Setting these permissions on /root isn't correct so I have to move the scripts to a folders which is usable by all users. 0
Please sign in to leave a comment.
Comments
4 comments