Skip to main content

cPanel Hooks or special configs for specific actions

Comments

11 comments

  • DavidN.
    Hi Ryan, Thanks for the question! cPanel has standardized hook points that execute before and after system backups run. There are also hook points that run before, during, and after each individual account backup, if you need finer-grained control. It sounds like these are the hook points you'll need:
    0
  • RyanBVI
    Hi Ryan, Thanks for the question! cPanel has standardized hook points that execute before and after system backups run. There are also hook points that run before, during, and after each individual account backup, if you need finer-grained control. It sounds like these are the hook points you'll need:
    Thank you David for your reply and help with this. It seems that backup system does actually already have an advanced method to satisfy all my needs, I checked the SDK and it's pretty much straight-forward for my needs... Do you have any suggestion also regarding the update system ("upcp" scheduled daemon) ??? Thanks again, waiting for your news regarding upcp.
    0
  • cPanelMichael
    Do you have any suggestion also regarding the update system ("upcp" scheduled daemon) ???

    Hello :) Yes, upcp is the first function listed at:
    0
  • RyanBVI
    Hello, yes, this seems to be what I am looking for, but still, I am unable to find how to achieve my task... Is there any real-life example, how I can actually implement these things ??? For example, let's say, I want to execute the following scripts: /usr/local/src/custom/updates/before.sh /usr/local/src/custom/updates/after.sh /usr/local/src/custom/backups/before.sh /usr/local/src/custom/backups/after.sh Can you please give me a real-life example, how these 4 scripts can be set to execute, each at the proper time ??? (Please note that the paths and filenames are self-explaining of what goes where...) Thanks for any help in advance !!!
    0
  • cPanelMichael
    The following thread offers an example of how someone implemented a custom script in the post stage for the upcp event:
    0
  • RyanBVI
    Hello, I have the following scripts: 1: /usr/local/src/custom/updates/before.sh 2: /usr/local/src/custom/updates/after.sh 3: /usr/local/src/custom/backups/before.sh 4: /usr/local/src/custom/backups/after.sh Each script, is a bash script, tested to work in standalone / shell execution mode (already chmoded to +x). Can anyone help me and explain me how I can add these scripts to execute at the proper time via cPanel Hooks system ??? 1: should run, BEFORE cPanel updater runs (before upcp) 2: should run, AFTER cPanel updater completes (after upcp) 3: should run, BEFORE cPanel new backups runs (before backups) 4: should run, AFTER cPanel new backups completes (after backups) Notice: I have seen that there is also a post-upcp action running regarding CloudLinux, my script should execute AFTER this is also completed. Actually, my scripts should explicitly execute before and after the cPanel daemons run. Thanks on advance for your help !!!
    0
  • cPanelMichael
    I've merged your post into this thread. Could you let us know if the last response in the thread referenced earlier is helpful? Thank you.
    0
  • DavidN.
    Hi Ryan, To get your hook scripts to run, you'll need to register them into the hooks database with the utility /usr/local/cpanel/bin/manage_hooks. The --help output there should be enough information to get you started. If you have any more questions, please let us know. Thanks! David Nielson Integration Developer, cPanel
    0
  • cPSarah
    Ryan, if you're in need of a step-by-step look at how to implement hooks, this tutorial might also be helpful:
    0
  • RyanBVI
    Ryan, if you're in need of a step-by-step look at how to implement hooks, this tutorial might also be helpful:
    0
  • cPanelMichael
    Is it possible to do this, without adding any extra code in the scripts and without the need to add them on specific paths, as indicated on the example ???

    Yes, for example you can utilize a simple .sh file that runs specific commands.
    Notice: I have seen that there is also a post-upcp action running regarding CloudLinux, my script should execute AFTER this is also completed.

    Yes, this is possible with the "--weight" option that's documented at: Guide to Standardized Hooks - The manage_hooks Utility - Software Development Kit - cPanel Documentation Thank you.
    0

Please sign in to leave a comment.