This article focuses on the WHM backup scripts, like the backup, backups_create_metadata, and backups_list_user_files script.
Introduction
Web Host Manager (WHM) is an administrative access tool for the backend of the cPanel account. With WHM, the users can create cPanel accounts to manage and create Linux hosting accounts. Moreover, the users can use WHM to manage multiple cPanel with the option to modify, upgrade or even downgrade an account, sell hosting services, and monitor the usage of bandwidth as well. Web Host Manager also allows users to access DNS zones of all the domains. The users can create, delete and suspend cPanel accounts using a WHM account. Apart from the ability of WHM to configure and support customer requests through the cPanel, it allows users to change the domain and usernames of clients. WHM also offers total backend control over cPanel and has many other benefits for Virtual Private Servers and Dedicated servers. In this article, we are trying to explain the WHM backup scripts, which will be helpful in many situations or if you are someone who loves to perform WHM operations via the backend.
The Backup Script
The users can use the backup (/usr/local/cpanel/bin/backup) script to run a manual backup in WHM via the command line. The system will read the backup configuration file and then perform the actions defined in the file. By default, the system will perform this process in the background. The users can review the log file for this script in the /usr/local/cpanel/logs/cpbackup directory.
In order to run a backup manually, the users need to first log in to the command line using SSH as the root user and then execute the following command:
/usr/local/cpanel/bin/backup
Along with the above command, the users can also use the following options:
Option |
Description |
Example |
force |
This option will forcefully perform a backup task, even if the system already contains the up-to-date backup files. |
/usr/local/cpanel/bin/backup --force |
debug |
This option will run the backup in the foreground and will print its progress on the command line. |
/usr/local/cpanel/bin/backup --debug |
help |
The help option will show all available options and information about this script |
/usr/local/cpanel/bin/backup --help |
allow-override |
When the system performs the backup, the users can use this option to run the pkgacct script in the /var/cpanel/lib/Whostmgr/Pkgacct/pkgacct directory. |
/usr/local/cpanel/bin/backup --allow-override |
The backups_create_metadata Script
The backups_create_metadata (/usr/local/cpanel/scripts/backups_create_metadata) script allows the users to create metadata files for all account backup types. The backups_create_metadata script generates metadata for all directories under the /home/username directory, except for the /mail and /.cpanel directories.
In order to execute the backups_create_metadata script on the command line, the users can use the following format:
/usr/local/cpanel/scripts/backups_create_metadata
Along with the above command, the users can also use the following options:
>> Note: The users must use at least one option to execute the backups_create_metadata script.
Option |
Description |
Example |
--all |
This option will create metadata files for all backups. The users cannot combine the --all option with other options. |
/usr/local/cpanel/scripts/backups_create_metadata --all |
--backup=[backup filename] |
This option helps create metadata files for the specified backup file. The users can combine this option with the --user option to create metadata for the specified user in the specified backup directory. |
/usr/local/cpanel/scripts/backups_create_metadata --backup=monthly/YYYY-MM-DD Or
|
--fix_corrupt |
This option helps the users to scan the metadata databases for corrupt files and then repair them. The users can combine this option with the --schedule_rebuild option to rebuild the metadata in a background task. |
/usr/local/cpanel/scripts/backups_create_metadata --fix_corrupt Or /usr/local/cpanel/scripts/backups_create_metadata --fix_corrupt --schedule_rebuild |
--schedule_rebuild |
This option is similar to the --all option, but it will run the script in the background. The users can combine this option with the --fix_corrupt option to rebuild the metadata in a background task. |
/usr/local/cpanel/scripts/backups_create_metadata --schedule_rebuild Or /usr/local/cpanel/scripts/backups_create_metadata --schedule_rebuild --fix_corrupt |
--user=[user] |
The --user=[user] option helps create metadata files for the specified user. This option can be combined with the --backup=[backup filename] option to create metadata for the specified user in the specified backup directory. |
/usr/local/cpanel/scripts/backups_create_metadata --user=username Or /usr/local/cpanel/scripts/backups_create_metadata --user=username --backup=monthly/YYYY-MM-DD |
--vacuum |
The --vacuum option defragments the metadata SQL database and it will free the unused space in the server. This option will only free space if unused space is available in the database. If the user has already used this option to free the space, then they can't use it again to clear additional space. >> Note: The users cannot combine the --vacuum option with other options. |
/usr/local/cpanel/scripts/backups_create_metadata --vacuum |
The backups_list_user_files Script
The backups_list_user_files (/usr/local/cpanel/scripts/backups_list_user_files) script helps the users to locates a user’s backup files and returns all of the backup files in the Comma-Separated Value (CSV) format.
In order to check and return a list of backup files, the users can execute the following command as the root user:
/usr/local/cpanel/scripts/backups_list_user_files [arguments]
The /usr/local/cpanel/scripts/backups_list_user_files script will accept the following arguments:
Argument |
Description |
Input Values |
Example |
--regexp=[string] |
The users can return the regular expression search results by using this argument. This argument will only accept one search value. |
The users can use only a valid string as this arguments input value. |
/usr/local/cpanel/scripts/backups_list_user_files --regexp='example' |
--user=[username] |
You can specify the cPanel username here whose backup files that you wish to search. |
The users can use the cPanel account’s username as the input value. |
/usr/local/cpanel/scripts/backups_list_user_files --user=username |
Conclusion
This article presents the WHM backup scripts, such as the backup, backups_create_metadata, and backups_list_user_files script. If you want to know more about the cPanel Web Hosting services offered by Clickhost Australia, please click here: cPanel Web Hosting.
If you'd love to discuss anything, you can chat with us using the live chat option available on our website or call our support line at 1300 969 155 to speak with one of our friendly sales team members!