Question
What is the cpconftool script?
Answer
The /usr/local/cpanel/bin/cpconftool script is used to backup, restore and transfer server configurations. You can back up, restore, and transfer the following configurations:
- Apache
- Backups
- cPanel themes
- Exim
- MySQL
- WHM(whmconf)
- Autossl
- cPHulk
- Greylisting
- ModSecurity
Backing up a configuration
You can backup a configuration by following these steps:
- Run the following command to backup a configuration:
/usr/local/cpanel/bin/cpconftool --backup --modules=X
Where 'X' represents the configuration name
For example, to backup the mysql configuration, type the following:
-bash-4.1# /usr/local/cpanel/bin/cpconftool --backup --modules=cpanel::system::mysql
Backup Successful
/home/whm-config-backup-cpanel__system__mysql-11.68.0.29-1522192417.tar.gz
-bash-4.1#
Restoring a configuration
To restore a configuration from a backup file, run the following command:
/usr/local/cpanel/bin/cpconftool --restore=backup.tar.gz --modules=X
Where backup.tar.gz represents the path to the desired backup file and 'X' represents the configuration name.
For example, to backup the mysql configuration, type the following:
/usr/local/cpanel/bin/cpconftool --modules=cpanel::system::mysql --restore=/home/whm-config-backup-cpanel__system__mysql-1522192417.tar.gz
The output will be similar to:
-bash-4.1# /usr/local/cpanel/bin/cpconftool --modules=cpanel::system::mysql --restore=/home/whm-config-backup-cpanel__system__mysql-1522192417.tar.gz
mysql restarted successfully.
Restore Successful
---
cpanel::system::mysql:
post_restore:
data: ''
status: 1
statusmsg: Successful
restore:
data:
version: 1.0.0
status: 1
statusmsg: "Whostmgr::Config::Restore::System::Mysql: ok"
-bash-4.1#
Please review the following to learn more pertaining to the cpconftool:
https://docs.cpanel.net/whm/scripts/the-cpconftool-script/