Page tree
Skip to end of metadata
Go to start of metadata

 

Description

This function configures a server's backup system. The system saves these settings in the /var/cpanel/backups/config file.

Examples 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/backup_config_set?api.version=1&backupenable=1&backuptype=incremental&backup_daily_enable=1&backupdays=0%2C1&backup_daily_retention=18&backup_monthly_enable=0&backupaccts=1&backuplogs=0&backupbwdata=1&localzonesonly=0&backupfiles=1&mysqlbackup=accounts&backupdir=%2Fbackup&keeplocal=1&backupmount=0
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/backup_config_set?api.version=1&backupenable=1&backuptype=incremental&backup_daily_enable=1&backupdays=0%2C1&backup_daily_retention=18&backup_monthly_enable=0&backupaccts=1&backuplogs=0&backupbwdata=1&localzonesonly=0&backupfiles=1&mysqlbackup=accounts&backupdir=%2Fbackup&keeplocal=1&backupmount=0
 Command Line
whmapi1 backup_config_set backupenable=1 backuptype=incremental backup_daily_enable=1 backupdays=0,1 backup_daily_retention=18 backup_monthly_enable=0 backupaccts=1 backuplogs=0 backupbwdata=1 localzonesonly=0 backupfiles=1 mysqlbackup=accounts backupdir=%2Fbackup keeplocal=1 backupmount=0

Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
    "metadata": {
        "version": 1,
        "reason": "OK",
        "result": 1,
        "command": "backup_config_set"
    }
}
 Output (XML)
<result>
   <metadata>
      <version>1</version>
      <reason>OK</reason>
      <result>1</result>
      <command>backup_config_set</command>
   </metadata>
</result>

Note:

Use WHM's API Shell interface (Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample

backup_daily_enable

Boolean

Whether to enable daily backups.

This parameter defaults to 1.

  • 1 — Enable.
  • 0 — Disable.
1

postbackup

Boolean

Whether to run the /usr/local/cpanel/scripts/postcpbackup script after the backup completes.

This parameter defaults to 0.

  • 1 — Run.
  • 0 — Do not run.
0

backupenable

Boolean

Whether to enable backups.

This parameter defaults to 0.

  • 1 — Enable.
  • 0 — Disable.
1

backup_monthly_enable

Boolean

Whether to enable monthly backups.

This parameter defaults to 0.

  • 1 — Enable.
  • 0 — Disable.
0

usebinarypkgacct

Boolean

The backup script to use.

This parameter defaults to 1.

  • 1/usr/local/cpanel/scripts/pkgacct
  • 0/usr/local/cpanel/bin/pkgacct
0

backuptype

string

The type of backup to create.

This parameter defaults to compressed.

  • compressed
  • uncompressed
  • incremental
compressed

backup_daily_retention

integer

The number of daily backups to keep.

This parameter defaults to 5.

A positive integer.5

backupdays

string

The days of the week to run backups.

This parameter defaults to 0,2,4,6 (Sunday, Tuesday, Thursday, and Saturday).

  • 0 — Sunday.
  • 1 — Monday.
  • 2 — Tuesday.
  • 3 — Wednesday.
  • 4 — Thursday.
  • 5 — Friday.
  • 6 — Saturday.

Note:

For multiple days, use a comma-delimited list.

0,1,2,3,4,5,6

backup_monthly_dates

integer

The days of the month to run backups.

This parameter defaults to 1.

A positive integer that represents the day of the month.

Note:

For multiple days, use a comma-delimited list.

1

backupfiles

Boolean

Whether to back up system files.

This parameter defaults to 1.

  • 1 — Back up.
  • 0 — Do not back up.
1

backupaccts

Boolean

Whether to back up accounts.

This parameter defaults to 1.

  • 1 — Back up.
  • 0 — Do not back up.
1

prebackup

Boolean

Whether to run the usr/local/cpanel/scripts/precpbackup script before the system processes backups.

This parameter defaults to 1.

  • 1 — Run.
  • 0 — Do not run.
1

psqlbackup

Boolean

Whether to back up PostgreSQL® databases.

This parameter defaults to 0.

  • 1 — Back up.
  • 0 — Do not back up.
0

keeplocal

Boolean

Whether to delete backups from the local directory.

This parameter defaults to 1.

  • 1 — Delete.
  • 0 — Do not delete.
1

localzonesonly

Boolean

Whether to use a local zonefile from the /var/named/domain.tld file or dnsadmin.

This parameter defaults to 0.

  • 1 — Use the /var/named/domain.tld file.
  • 0 — Use dnsadmin.
0

backupbwdata

Boolean

Whether to back up bandwidth tracking data.

This parameter defaults to 1.

  • 1 — Back up.
  • 0 — Do not back up.
1

dieifnotmounted

Boolean

Whether to stop the backup process if the backup directory is not mounted.

This parameter defaults to 0.

  • 1 — Stop.
  • 0 — Do not stop.
0

backuplogs

Boolean

Whether to back up the error logs.

This parameter defaults to 0.

  • 1 — Back up.
  • 0 — Do not back up.
0

linkdest

Boolean

Whether to check rsync for hardlink support.

This parameter defaults to 0.

  • 1 — Check.
  • 0 — Do not check.
0

backupsuspendedaccounts

Boolean

Whether to back up suspended accounts.

This parameter defaults to 0.

  • 1 — Back up.
  • 0 — Do not back up.
0

gziprsyncopts

string

gzip environment variables.

This parameter defaults to a blank value.

A valid string.--rysncable

backupdir

string

The primary backup directory.

This parameter defaults to /backup.

An absolute file path./backup

errorthreshhold

integer

The number of times that the system will try to use the additional backup destination.

This parameter defaults to 3.

A positive integer.3

backupmount

Boolean

Whether to mount a backup partition.

This parameter defaults to 0.

  • 1 — Mount.
  • 0 — Do not mount.
0

mysqlbackup

string

The backup method to use for MySQL® databases.

This parameter defaults to accounts.

  • accounts — Back up databases in each account's archive.
  • entire — Back up all of the databases in one file.
  • both — Back up databases in each account's archive and together in one file.
accounts

backup_monthly_retention

integer

The number of monthly backups to keep.

This parameter defaults to 1.

A positive integer.5

Returns

This function only returns metadata.