MHFraser

Member
Feb 28, 2019
11
0
1
Australia
cPanel Access Level
Root Administrator
Hi,
I'm new to cpanel so perhaps I have overlooked something blindingly obvious.

I'm trying to run a post upcp script but the script is not being invoked.

I have resgistered a standardised hook
Code:
/usr/local/cpanel/bin/manage_hooks add script /usr/local/bin/update-alert.sh --manual --category System --event upcp --stage post
The hook shows up in the list
Code:
/usr/local/cpanel/bin/manage_hooks list
System:
    upcp:
        id: af8d4efd-c6bc-412f-bd51-1fbc9b5e8506
        weight: 100
        stage: post
        hook: /usr/local/bin/update-alert.sh
        exectype: script
        escalateprivs: 0
However it is never called (it should run at 95%)
Code:
=> Log opened from cPanel Update (upcp) - Slave (1476) at Tue Feb  4 06:33:03 2020
[2020-02-04 06:33:03 +0000]   Pre Maintenance completed successfully
[2020-02-04 06:33:03 +0000]   95% complete
[2020-02-04 06:33:03 +0000]   100% complete
[2020-02-04 06:33:03 +0000]   
[2020-02-04 06:33:03 +0000]     cPanel update completed
[2020-02-04 06:33:03 +0000]   A log of this update is available at /var/cpanel/updatelogs/update.1580797973.log
[2020-02-04 06:33:03 +0000]   Removing upcp pidfile
[2020-02-04 06:33:03 +0000]   
[2020-02-04 06:33:03 +0000] Completed all updates
looking at the source for upcp I see:
Code:
    if ( -e '/var/cpanel/hooks.yaml' && -x '/usr/local/cpanel/scripts/hook' ) {
        $logger->info("Running Standardized hooks");
        system '/usr/local/cpanel/scripts/hook', '--category=System', '--event=upcp', '--stage=post';
    }
so lets check:
Code:
ls -l /var/cpanel/hooks.yaml
ls: cannot access /var/cpanel/hooks.yaml: No such file or directory
well there's my problem, no hooks.yaml.

however re reading the guide to standardised hooks down the bottom I see that version 84 doesn't have a central database, so the non-existent hooks.yaml is expected and so the test in /usr/local/cpanel/scripts/uucp -e '/var/cpanel/hooks.yaml' on my up to date 84.0.21 box will always fail?

Am I doing something wrong here?



cPanel & WHM version 84 and later
Standardized Hooks System data is in subdirectories within the /var/cpanel/hooks/data/ directory. This allows the system to isolate individual events for better performance.
  • Each subdirectory includes a .yaml file and a .cache file.
  • For example, the /var/cpanel/hooks/data/Passwd/ directory could contain the change_password.yaml file and the change_password.cache file.
cPanel & WHM version 82 and earlier
Standardized Hooks System data is in the /var/cpanel/ directory. This is the authoritative reference for all standardized hook data.
  • The /var/cpanel/hooks.yaml file contains the hook database.
  • The /var/cpanel/hooks.cache file contains a cached copy of the database. The cache file regenerates automatically whenever you query the Standardized Hooks System internally or through a management utility.
 

koree

cPanel Product Owner
Staff member
Feb 15, 2004
8
1
228
@MHFraser I'm sorry for the trouble you are having. This is definitely not anything you are doing wrong. There is an issue in the hooks system. We currently have a fix being tested for this, and it will be rolled out ASAP. Please let me know if you have any questions.

Thanks!

Koree Smith
Product Owner
cPanel, LLC
 
Last edited by a moderator: