Has anyone started anything to automate downloads of the latest Full Backup from a cpanel server? Our host provider lost both the live servers AND servers hosting the backups, though they did recover most of it. I would just like to be prepared should it happen again, and I'd like to automate the process.
A glance at the Jetapi didn't make it obvious how to generate a download, register for a call back when it is done, and then download from a provided link.
use API to automate download of latest Full Backup
-
- Staff Member
- Posts: 97
- Joined: January 1st, 2021, 12:51 am
Re: use API to automate download of latest Full Backup
Hello,
Thank you for your interest in using our JETAPI to automate your download process. I would like to provide more information about our JETAPI Calls and our JetBackup 5 Hooks that could be used to achieve your request.
1. Generating the JetBackup Download
JetBackup 5 uses the Queue to process all JetBackup jobs (backups, restores, reindex, and downloads). In order to Queue a Download of the most recent backup you would need to use the following command:
Please note that the `snapshot_id` is the parent id of the entire backup and can be found for a specific account by using the following JETAPI command:
When it returns you will be able to spot the snapshot_id/parent_id of the most recent Full Account Backup for the specified account. The return would like like the following:
2. Using JetBackup 5 Hook
JetBackup 5 has a custom Hook feature that allows you to run custom scripts before/after key events. In this case, a Post Download Hook would allow you to run a call back when the download is complete. You can find more information on JetBackup 5 Hooks and how to configure one here: JetBackup 5 Hooks Documentation
The JETAPI Call listDownloads is then one example of fetching the recent downloaded backup. An example would be the following:
This command will return the single most recent download data which includes the full path to the download.
I hope you find all of this information helpful.
Thank you for your interest in using our JETAPI to automate your download process. I would like to provide more information about our JETAPI Calls and our JetBackup 5 Hooks that could be used to achieve your request.
1. Generating the JetBackup Download
JetBackup 5 uses the Queue to process all JetBackup jobs (backups, restores, reindex, and downloads). In order to Queue a Download of the most recent backup you would need to use the following command:
Code: Select all
jetbackup5api -F addQueueItems -D 'type=4&snapshot_id={Backup_Parent_ID}'
Code: Select all
jetbackup5api -F listBackupForAccounts-D 'type=1&contains=511&filter={acctname}'
Code: Select all
data:
accounts:
0:
account_id: 612f868d45ce517f430759b4
account: acct0001
backup:
_id: 614283688be0b2184c2e6b02
parent_id: 61424b257f9a7106a1423813
account_id: 612f868d45ce517f430759b4
....
JetBackup 5 has a custom Hook feature that allows you to run custom scripts before/after key events. In this case, a Post Download Hook would allow you to run a call back when the download is complete. You can find more information on JetBackup 5 Hooks and how to configure one here: JetBackup 5 Hooks Documentation
The JETAPI Call listDownloads is then one example of fetching the recent downloaded backup. An example would be the following:
Code: Select all
jetbackup5api -F listDownloads -D 'sort[created]=-1&limit=1'
I hope you find all of this information helpful.
Best Regards,
Richard, JetApps Team
Richard, JetApps Team