When utilizing CPanel, it’s important to note that there are limitations in place for inodes and file usage, and it’s essential to keep track of them. To assist with this process, we’ve taken the liberty of crafting an in-depth guide that walks you through the process of creating a plugin that counts your usage step-by-step. This will make it easier to audit and ensure you stay within the usage limits. If you require any assistance or have any further questions, please don’t hesitate to reach out. We’re here to help!
Step 1: Log in to WHM
Using your server credentials, securely login to the Web Host Manager (WHM) interface.
Step 2: Navigate to the Account List
Access the ‘List Accounts’ section within WHM.
Step 3: Open the Desired cPanel Account
Select the specific cPanel account you wish to work with.
Step 4: Access File Manager
Within the cPanel account, locate and enter the ‘File Manager’.
Step 5: Upload the Plugin
Initiate the upload process by selecting the ‘Upload’ option and provide the designated .zip file as instructed given below
Step 6: Access the Terminal or SSH
Option 1: Open the terminal within WHM or, alternatively
Option 2: Establish an SSH connection as root using a tool like Putty.
We are using Terminal within WHM
Step 7: Navigate to Upload Location
Change the directory to the location where the file was uploaded:
cd /home/cpaneluser
Step 8: Move the File to the Plugin Directory
Place the file in the designated plugin directory:
Step 9: Navigate to Plugin Directory
Change the directory to the plugin location:
Step 10: Extract the Zip File
Unzip the uploaded file:
Step 11: Install the Plugin
Execute the installation command:
The script which is used in the plugin
#!/bin/bash # Function to calculate inode usage and format the output calculate_inode_usage() { local current_dir="$1" local user_dir="$(pwd)" printf "%-45s %s\n" "Directory" "Inode Count" echo "-----------------------------------------|-------------------" find "$current_dir" -maxdepth 2 -type d | while read dir; do inode_count=$(find "$dir" -type f | wc -l) dir_name=${dir//$user_dir/} # Remove /home/user/ from the path printf "%-45s %d\n" "$dir_name" "$inode_count" echo "-----------------------------------------|---------------------" done } # Get the current directory current_directory="$(pwd)" # Display inode usage for the current directory and its immediate subdirectories calculate_inode_usage "$current_directory"
Please ensure that you perform these actions with the utmost caution, taking into account your specific server configuration and security protocols. If you encounter any issues during this process, consult with your server administrator or support team.