The backup script located at /usr/local/cpanel/bin/backup lets you run manual backups via the command line in WHM (Web Host Manager). When you execute this script, the system reads your backup configuration file and performs the backup actions defined there, running the process in the background by default. You can monitor progress by reviewing the log files stored in the /usr/local/cpanel/logs/cpbackup directory.
How to Run a Manual Backup
To execute a manual backup, you need to log in to your server via SSH as the root user. Once logged in, run the following command:
/usr/local/cpanel/bin/backup
This command initiates the backup process using your current backup configuration settings. The backup runs in the background by default, allowing you to continue using the command line while the backup completes.
Available Backup Script Options
The backup script accepts several command-line options that modify how the backup runs. These options give you more control over the backup process and can help with troubleshooting or forcing new backups.
Debug Mode
Use the --debug option to run the backup in the foreground and display real-time progress on your command line. This is helpful when you need to monitor the backup process closely or troubleshoot issues.
Example: /usr/local/cpanel/bin/backup --debug
Force Option
The --force option creates an additional backup even if the system already has up-to-date backup files. This is useful when you want to create a backup at a specific point in time, regardless of when the last backup ran.
Example: /usr/local/cpanel/bin/backup --force
Allow Override
When you use the --allow-override option, the system uses the pkgacct script located in the /var/cpanel/lib/Whostmgr/Pkgacct/pkgacct directory during the backup process. This option is typically used for advanced backup configurations.
Example: /usr/local/cpanel/bin/backup --allow-override
Help Option
The --help option displays additional information about the backup script and all available options directly in your terminal.
Example: /usr/local/cpanel/bin/backup --help
Understanding Backup Logs
After running the backup script, you can review detailed logs to verify the backup completed successfully. These logs are stored in the /usr/local/cpanel/logs/cpbackup directory. The logs contain information about what was backed up, any errors encountered, and the total time the backup took to complete.
Frequently Asked Questions
Can I run multiple backup script options at the same time?
Yes, you can combine multiple options in a single command. For example, you can use both --debug and --force together: /usr/local/cpanel/bin/backup --debug --force. This runs a forced backup in the foreground with real-time output.
Why would I use the force option instead of waiting for scheduled backups?
The force option is useful when you need an immediate backup before making major changes to your server or websites. It ensures you have a current backup regardless of your backup schedule, providing an extra safety net before performing updates, migrations, or configuration changes.
Where can I configure my backup settings before running the backup script?
You can configure your backup settings through WHM's Backup Configuration interface. The backup script reads these configuration settings when it runs, so any changes you make in WHM will affect how the script performs backups.
What happens if a backup is already running when I execute the backup script?
The system typically prevents multiple backup processes from running simultaneously to avoid conflicts and resource issues. If a backup is already in progress, you may receive an error message. Wait for the current backup to complete before starting another one.
If you need help with backup scripts or encounter any issues with your backups, our support team at OBHost is available 24/7 to assist you. Contact us at https://www.obhost.net/contact or email support@obhost.org for technical assistance.