Backups and migrations
Automate backups with cPanel and cron
You can automate your own backups with UAPI, the cPanel API, and a cron job. This complements the backups Hostsuar keeps; it does not change their frequency or retention.
Request a full backup
From a terminal in the cPanel account itself, the command is:
uapi Backup fullbackup_to_homedir
To ask for a notification when it finishes, you can add your address:
uapi Backup fullbackup_to_homedir email=usuario@ejemplo.com
Replace the example address. The backup is generated in the account's home directory. The request being accepted does not mean the file is finished: check the result before transferring or using it.
If you have no terminal access or the command is not available, ask support which method suits your service. Do not run the command as an administrator of another system expecting it to identify your account.
Before you schedule it
Run a manual request and confirm that it finishes. Check how much space the file and the generation process need, and the load on the account. No percentage of free space guarantees every backup.
Decide how many changes you can afford to lose between runs and how long you will keep versions. In an application with continuous writes, plan how you will get files and a database that are consistent; running backups more often does not solve that consistency on its own.
What the automation must control
| Step | Check needed |
|---|---|
| Start | No other generation or transfer is pending |
| Wait | That specific backup has finished successfully |
| Transfer | The right file is copied over an encrypted connection |
| Verify | The destination received the complete file and it can be read |
| Apply retention | The independent versions you need are kept |
| Report | Failures produce an alert that someone reviews |
Do not add a fixed wait time or simply pick the most recent file as proof that the backup has finished. If generation or transfer fails, keep the previous backups and log the error.
Set up cron and the destination
In cPanel > Cron Jobs, schedule the script that implements those checks. See how to set up a scheduled task. This article gives you the request command, not a complete transfer and retention script.
Use SFTP/SCP or another compatible encrypted destination. Store keys outside the public folder, with restricted permissions, and verify the destination server. Do not put passwords on the cron line or in files that can be downloaded from the web.
Check that you will be able to restore it
Keep a log of date, file, components and verification. Test a restore in a separate environment from time to time. A full cPanel backup needs the appropriate recovery procedure; it cannot be restored in full from the user's wizard.
If a backup fails, fix the cause before deleting older versions or reducing retention.
You may also find useful
- Hosting backups: what to keep and how to restore it Choose between Hostsuar's backups and your own, check what they contain and plan a recovery with the...
- JetBackup for WordPress: restore provider backups from WordPress Connect the plugin to Hostsuar's backups, select files and database and check the result of the rest...
- Restore a website or recover email from the client area Check the site, folder, database and date before restoring, or recover messages while keeping recent...
- Restore or download backups with JetBackup Choose the date and the smallest resource to restore files, databases, email or settings, or prepare...
Something wrong or out of date? Tell us and we will review it.