Script to enable/disable Backup Configuration "Additional Destinations"

techguide

Active Member
Aug 29, 2012
29
4
53
cPanel Access Level
Reseller Owner
Hi, I wish to toggle enable/disable via a script for the "Additional Destinations" in the WHM>Backup Configuration settings. Via script enable it temporarily, then disable it - via a scheduled cron script.

We do frequent backups to local hard disk but for disaster recovery we want to rsync *some* but not all backups off the server. This setup works well with the rsync Additional Destination enabled; but then it transports ALL backups off the server; which are too many in this example.

I was looking at the WHM API1 and 2 but I don't see a way to use this via the API, is there another way to access this variable and turn it on/off at select times?

Alternatively I could use a specific rsync script not associated with the WHM Backup configuration; but the above method seems a little cleaner and easier to manage if it is possible...?
Thanks for any insight!

AdditionalDestinations.JPG
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,271
313
Houston

techguide

Active Member
Aug 29, 2012
29
4
53
cPanel Access Level
Reseller Owner
It if helps anyone else, on cpanel 86, these scripts work to enable/disable remote backup destinations:
[root]#cat DisableDestination.sh
#!/bin/sh
# Will disable the remote destination
/usr/local/cpanel/bin/whmapi1 backup_destination_set type=Rsync id={your backup destination ID here} name={your backup destination name here} disabled=1

[root]# cat EnableDestination.sh
#!/bin/sh
#Will enable the remote destination
/usr/local/cpanel/bin/whmapi1 backup_destination_set type=Rsync id={your backup destination ID here} name={your backup destination name here} disabled=0

Then execute the scripts at certain day/times via a cronjob (the example below enable on thursdays at 12:30am, disable on Thursdays at 7am):
30 0 * * THU /root/EnableDestination.sh 2>&1
00 7 * * THU /root/DisableDestination.sh 2>&1