Paper Lantern for cPanel accounts is being retired this year. Find out more »
cPanel & WHM Version 102 has been released, and brings a slew of great updates. Take a look at what is included, and then upgrade today!

Add Pre and Post Hooks for /scripts/restartsrv_* Scripts

Ricky Grassmuck shared this idea 5 years ago
Open Discussion

As a server administrator I would like cPanel to add Pre- and Post- hooks for service restarts to allow integrators and advanced users to trigger actions around service restarts.


This could be implemented either using the Manage Hooks feature in WHM or by the creation of a script following a predetermined naming scheme like the examples below.

Pre service restart script examples:

  • /scripts/pre_restartsrv_httpd
  • /scripts/pre_restartsrv_mysqld

Post service restart script examples

  • /scripts/post_restartsrv_httpd
  • /scripts/post_restartsrv_mysqld

The idea here obviously is that simply having the scripts present will lead to them being invoked when the corresponding restartsrv script is run.

Regardless of the method used to implement this functionality it's important that cPanel give it's more advanced users and developers the ability to properly manage the events that need to occur when starting, stopping and restarting services.

Leave a Comment
Attach a file