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

 

Description

This function retrieves your backup destination configuration file data.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/backup_config_get?api.version=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/backup_config_get?api.version=1
 Command Line
whmapi1 backup_config_get

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)
{
  "data": {
    "backup_config": {
      "backup_daily_enable": 1,
      "backup_weekly_enable": 1,
      "postbackup": 0,
      "backupenable": 1,
      "backup_monthly_enable": 1,
      "maximum_timeout": "2700",
      "backuptype": "compressed",
      "backup_daily_retention": "2",
      "backupdays": "0,1,2,3,4,5,6",
      "backup_monthly_dates": "1,15",
      "backupfiles": 1,
      "backupaccts": 1,
      "prebackup": "1",
      "backup_weekly_retention": "4",
      "psqlbackup": 0,
      "backup_weekly_day": "0",
      "keeplocal": "1",
      "localzonesonly": 0,
      "backupbwdata": 1,
      "backuplogs": 0,
      "linkdest": 0,
      "gziprsyncopts": "--rsyncable",
      "backupdir": "/backup",
      "errorthreshhold": 3,
      "backupmount": 0,
      "backup_monthly_retention": "1",
      "backupsuspendedaccts": 0,
      "mysqlbackup": "accounts",
      "check_min_free_space": "1",
      "min_free_space": "1024",
      "min_free_space_unit": "MB",
      "force_prune_daily": 0;
      "force_prune_weekly": 0;
      "force_prune_monthly": 0
    }
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": 1,
    "command": "backup_config_get"
  }
}
 Output (XML)
<result>
    <data>
        <backup_config>
            <backup_daily_enable>1</backup_daily_enable>
            <backup_weekly_enable>1</backup_weekly_enable>
            <postbackup>0</postbackup>
            <backupenable>1</backupenable>
            <backup_monthly_enable>1</backup_monthly_enable>
            <maximum_timeout>2700</maximum_timeout>
            <backuptype>compressed</backuptype>
            <backup_daily_retention>2</backup_daily_retention>
            <backupdays>0,1,2,3,4,5,6</backupdays>
            <backup_monthly_dates>1,15</backup_monthly_dates>
            <backupfiles>1</backupfiles>
            <backupaccts>1</backupaccts>
            <prebackup>1</prebackup>
            <backup_weekly_retention>4</backup_weekly_retention>
            <psqlbackup>0</psqlbackup>
            <backup_weekly_day>0</backup_weekly_day>
            <keeplocal>1</keeplocal>
            <localzonesonly>0</localzonesonly>
            <backupbwdata>1</backupbwdata>
            <backuplogs>0</backuplogs>
            <linkdest>0</linkdest>
            <gziprsyncopts>--rsyncable</gziprsyncopts>
            <backupdir>/backup</backupdir>
            <errorthreshhold>3</errorthreshhold>
            <backupmount>0</backupmount>
            <backup_monthly_retention>1</backup_monthly_retention>
            <backupsuspendedaccts>0</backupsuspendedaccts>
            <mysqlbackup>accounts</mysqlbackup>
            <check_min_free_space>1</check_min_free_space>
            <min_free_space>1024</min_free_space>
            <min_free_space_unit>MB</min_free_space_unit>
            <force_prune_daily>0</force_prune_daily>
            <force_prune_weekly>0</force_prune_weekly>
            <force_prune_monthly>0</force_prune_weekly>
        </backup_config>
    </data>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <command>backup_config_get</command>
    </metadata>
</result>


Note:

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

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
backup_confighashA hash of backup configuration data.This hash includes the backup_daily_enable, postbackup, backupenable, backup_monthly_enable, usebinarypkgacct, backuptype, backup_daily_retention, backupdays, backup_monthly_dates, backupfiles, backupaccts, prebackup, psqlbackup, keeplocal, localzoneonly, backupbwdata, dieifnotmounted, backuplogs, linkdest, backupsuspendedaccounts, gziprsyncopts, backupdir, errorthreshhold, backupmount, mysqlbackup, backup_weekly_day, backup_weekly_enable, backup_weekly_retention, maximum_restore_timeout, maximum_timeout, and backup_monthly_retention returns.
 

backup_daily_enable

Boolean

Whether to enable daily backups. 

The function returns this value in the backup_config hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

postbackup

Boolean

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

The function returns this value in the backup_config hash.

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

backupenable

Boolean

Whether to enable backups. 

The function returns this value in the backup_config hash.

  • 1 — Enabled.
  • 0 — Disabled.
1

backup_monthly_enable

Boolean

Whether to enable monthly backups. 

The function returns this value in the backup_config hash.

  • 1 — Enabled.
  • 0 — Disabled.
0

usebinarypkgacct

Boolean

The backup script to use.

Note:

We removed this return in cPanel & WHM version 11.42. 

The function returns this value in the backup_config hash.

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

backuptype

string

The type of backup to create.

The function returns this value in the backup_config hash.

  • compressed
  • uncompressed
  • incremental
compressed

backup_daily_retention

integer

The number of daily backups to retain.

The function returns this value in the backup_config hash.

A positive integer.5

backupdays

string

Which days of the week to run daily backups.

The function returns this value in the backup_config hash.

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

Note:

For multiple days, use a comma-separated list.

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

backup_monthly_dates

integer

Which days of the month to run monthly backups.

The function returns this value in the backup_config hash.

A positive integer that represents the day of the month.

Note:

For multiple days, use a comma-separated list.

1

backup_weekly_day

integer

Which day of the week to run weekly backups.

The function returns this value in the backup_config hash.

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

backup_weekly_enable

Boolean

Whether to enable weekly backups. 

The function returns this value in the backup_config hash.

  • 1 — Enable.
  • 0 — Disable.
0

backup_weekly_retention

integer

The number of weekly backups to retain.

The function returns this value in the backup_config hash.

A positive integer.4

maximum_restore_timeout

integer

How long a restoration will attempt to run, in seconds. If the restoration does not succeed in this amount of time, it will stop.

The function returns this value in the backup_config hash.

A positive integer.21600

maximum_timeout

integer

How long a backup will attempt to run, in seconds. If the backup does not succeed in this amount of time, it will stop.

The function returns this value in the backup_config hash.

A positive integer.7200

backupfiles

Boolean

Whether to back up system files.

The function returns this value in the backup_config hash.

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

backupaccts

Boolean

Whether to back up accounts.

The function returns this value in the backup_config hash.

  • 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.

The function returns this value in the backup_config hash.

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

 

1

psqlbackup

Boolean

Whether to back up PostgreSQL® databases.

The function returns this value in the backup_config hash.

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

 

0

keeplocal

Boolean

Whether to delete backups from the local directory.

The function returns this value in the backup_config hash.

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

localzonesonly

Boolean

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

The function returns this value in the backup_config hash.

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

backupbwdata

Boolean

Whether to back up bandwidth tracking data.

The function returns this value in the backup_config hash.

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

 

1

dieifnotmounted

Boolean

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

Note:

We removed this return in cPanel & WHM version 64. 

The function returns this value in the backup_config hash.

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

backuplogs

Boolean

Whether to back up the error logs.

The function returns this value in the backup_config hash.

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

 

0

linkdest

Boolean

Whether to check the rsync function for hardlink support.

The function returns this value in the backup_config hash.

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

backupsuspendedaccounts

Boolean

Whether to back up suspended accounts.

The function returns this value in the backup_config hash.

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

 

0

gziprsyncopts

string

gzip environment variables.

The function returns this value in the backup_config hash.

A valid string.--rysncable

backupdir

string

The primary backup directory.

The function returns this value in the backup_config hash.

An absolute file path./backup

errorthreshhold

integer

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

The function returns this value in the backup_config hash.

A positive integer.3

backupmount

Boolean

Whether the system mounted a backup partition.

The function returns this value in the backup_config hash.

  • 1 — Mounted.
  • 0Not mounted.
0

mysqlbackup

string

The method that the system uses to back up MySQL® databases.

The function returns this value in the backup_config hash.

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

backup_monthly_retention

integer

The number of monthly backups to retain.

The function returns this value in the backup_config hash.

A positive integer.5

check_min_free_space

Boolean

Whether to ensure that the destination server possesses the minimum free disk space.

Note:

We introduced this return in cPanel & WHM version 64.

The function returns this value in the backup_config hash.
  • 1 — Check the free disk space on the destination server.
  • 0 — Do not check the free disk space on the destination server.
1

min_free_space

string

The minimum amount of free disk space to check for on the destination server.

Note:

We introduced this return in cPanel & WHM version 64.

The function returns this value in the backup_config hash.
A positive number.1024

min_free_space_unit

string

The units of measure of disk space for the min_free_space return.

Note:

We introduced this return in cPanel & WHM version 64.

The function returns this value in the backup_config hash.
  • MB — Megabytes.
  • percent — Percent available.
MB

force_prune_daily

Boolean

Whether to strictly enforce the value of the backup_daily_retention parameter.

Note:

We introduced this return in cPanel & WHM version 64.

The function returns this value in the backup_config hash.
  • 1 — Strictly enforce the backup_daily_retention setting.
  • 0 — Only enforce the backup_daily_retention setting after a successful complete backup.
0

force_prune_weekly

Boolean

Whether to strictly enforce the value of the backup_weekly_retention parameter.

Note:

We introduced this return in cPanel & WHM version 64.

The function returns this value in the backup_config hash.
  • 1 — Strictly enforce the backup_weekly_retention setting.
  • 0 — Only enforce the backup_weekly_retention setting after a successful complete backup.
0

force_prune_monthly

Boolean

Whether to strictly enforce the value of the backup_monthly_retention parameter.

Note:

We introduced this return in cPanel & WHM version 64.

The function returns this value in the backup_config hash.
  • 1 — Strictly enforce the backup_monthly_retention setting.
  • 0 — Only enforce the backup_monthly_retention setting after a successful complete backup.
0