The Manage Hooks interface in WHM allows server administrators to view, organize, and control the execution order of hooks on your server. Hooks are automated scripts that run when specific server events occur, and this interface provides a centralized way to manage them without editing configuration files directly. While you can manage existing hooks through this interface, creating new hooks requires command-line access.
Understanding the Manage Hooks Interface
When you access the Manage Hooks interface, you'll see a table that organizes all hooks by their event type and execution order. This default sorting makes it easy to see which hooks run for specific server actions and in what sequence they execute.
The interface includes several helpful features to navigate your hooks efficiently:
- Use the Search text box to quickly find a specific hook by name
- Click Collapse All to hide hook attributes and actions for a cleaner view
- Click Expand All to display all hook details at once
Important: You must create and edit hook files using the command line. The Manage Hooks interface is designed for viewing and organizing existing hooks, not creating new ones.
Hook Information Displayed
The hooks table displays several columns of information to help you understand each hook's purpose and configuration:
Event/Hook Column
This column contains multiple rows of information:
- The first row shows the hook's event type (such as PkgAcct for account package events)
- The second row displays the hook's file location on the server
- Up and down arrows allow you to change the execution order of hooks within the same event type
For example, if you have multiple hooks for the pure-ftpd event, you might see locations like /scripts/postftpup and /scripts/postftpinstall. You can click the arrows to determine which hook runs first.
Stage Column
The Stage column indicates when the hook executes relative to the triggering event. Common stages include:
- pre – Runs before the event occurs
- post – Runs after the event completes
Understanding the stage helps you determine whether a hook validates actions before they happen or performs cleanup tasks afterward.
Description/Notes Column
This column shows the unique identifier for each hook, helping you distinguish between different hooks that may trigger on the same event.
Attributes Column
The Attributes column uses icons to indicate the hook's behavior and status:
- A blue icon indicates that the hook can block certain server actions (for example, preventing account creation if specific conditions aren't met)
- A green icon shows that the hook is active and running normally
- Other icons may indicate warning states or disabled hooks
Changing Hook Execution Order
The order in which hooks execute can be important, especially when multiple hooks respond to the same event. OBHost's interface makes it simple to adjust this order:
- Locate the hook you want to reorder in the table
- Click the up arrow to move the hook earlier in the execution sequence
- Click the down arrow to move the hook later in the execution sequence
When you change the order, the interface updates immediately, and the new order takes effect for future hook executions.
Best Practices for Hook Management
Managing hooks effectively requires understanding how they interact with your server operations:
- Regularly review your hooks to ensure they're all necessary and functioning correctly
- Test hook order changes on a staging environment before applying them to production servers
- Document custom hooks so other administrators understand their purpose
- Monitor server logs after adding or reordering hooks to catch any unexpected behavior
- Keep hook scripts simple and focused on specific tasks to reduce maintenance complexity
Common Hook Events
Understanding common hook events helps you organize and manage your server automation:
- PkgAcct: Triggers when creating or modifying account packages
- Accounts: Runs during account creation, modification, or deletion
- Backup: Executes before or after backup operations
- DNS: Triggers when DNS zone files are modified
- Email: Runs when email accounts or settings change
Frequently Asked Questions
Can I create new hooks directly in the Manage Hooks interface?
No, you cannot create new hooks through the WHM interface. Hook creation requires command-line access to your server where you'll write the hook script and place it in the appropriate directory. The Manage Hooks interface is designed only for viewing and organizing existing hooks.
What happens if I change the order of critical system hooks?
Changing the execution order of system hooks can affect server functionality. Always test order changes in a development environment first. If a hook depends on another hook's output, running them out of order may cause errors or unexpected behavior.
How do I disable a hook without deleting it?
The Manage Hooks interface doesn't provide a disable option. To temporarily disable a hook, you need to use command-line access to rename the hook file or move it to a different directory. This preserves the hook for future use while preventing it from executing.
Why don't I see all my custom scripts in the Manage Hooks interface?
The Manage Hooks interface only displays scripts that follow the standardized hooks format and are placed in the correct directories. If your custom scripts use legacy methods or are stored in non-standard locations, they won't appear in this interface.
If you need assistance managing hooks on your server or have questions about hook functionality, OBHost's support team is available 24/7 to help. Visit our contact page or email support@obhost.org for expert guidance.