Script hooks execute custom-written code when system-level operations meet specified conditions.
To create a script hook, place a shell script inside of the
/scripts/ directory, and pass any data to the script via the
The system displays a script hook's output in the command line, and also records in in the
/logs file. The output contains a "before" and "after" visual separator.
You script hook must possess
root:root ownership, and
755 file permissions.
|This script hook triggers when a build begins. If the build does not exit cleanly, this script hook halts the build. You can use this script to alert users of Apache's current update status, or to lock the |
|This script hook triggers at the end of a successful build. You can use this script hook to verify that a customization still functions, or alert a user when the Apache update process completes.|
|This script hook runs before the |
|This script hook runs after the |
|This script hook triggers before EasyApache confirms that the |
|This script hook triggers after EasyApache confirms that the |
To run EasyApache without script hooks via the command line, execute the
scripts/easyapache --skip-hooks script.
For information about how to run EasyApache without script hooks within WHM, read our EasyApache Profile Stage documentation.
Force a failure
You can force a failure with a script that does not exit cleanly. For example, you can configure the
/scripts/preeasyapache script to prevent an EasyApache build creation if a particular condition does not exist in the system.
The following is a
/scripts/preeasyapache Perl script deliberately prevents an EasyApache build creation.
Script hook arguments
The system passes the following arguments into ever script hook in the order that the table below lists:
The version of EasyApache that you currently use.
Your EasyApache version's revision number.
This value does not always appear as an integer.
The version of Apache that the script builds.
A comma-separated string of which PHP versions that the script creates.
|Any of the |
The following example demonstrates how to use these arguments:
The ea3_params_yaml environment variable
ea3_params_yaml variable is a script hook's environmental variable. This variable contains a YAML data structure of parameters that is sent to EasyApache.
You can use the
--hook-args flag to pass custom data to script hooks, which also avoid sconflicts with any flags that the
Cpanel::Easy framework uses. For example: