Child pages
  • WHM API 1 Functions - backup_config_set

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function configures a server's backup system.

 The system saves these settings in the /var/cpanel/backups/config file.

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titleJSON API


Code Block
languagexml
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&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



Expand
titleXML API


Code Block
languagexml
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&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



Expand
titleCommand Line


Code Block
languagebash
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 check_min_free_space=1 min_free_space=1024 min_free_space_unit=MB

Include Page
LIB:_WHMAPI1CLINote
LIB:_WHMAPI1CLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
    "metadata": {
        "version": 1,
        "reason": "OK",
        "result": 1,
        "command": "backup_config_set"
    }
}



Expand
titleOutput (XML)


Code Block
languagetext
linenumberstrue
<result>
   <metadata>
      <version>1</version>
      <reason>OK</reason>
      <result>1</result>
      <command>backup_config_set</command>
   </metadata>
</result>


Include Page
LIB:_WHMAPIShellNote
LIB:_WHMAPIShellNote



Parameters

ParameterTypeDescriptionPossible valuesExample

backup_daily_enable

Boolean

Whether to enable daily backups.

This parameter defaults to 1.

  • 1 — Enable.
  • 0 — Disable.
1

backup_daily_retention

integer

The number of daily backups to retain.

This parameter defaults to 5.

A positive integer.5

backup_monthly_dates

integer

Which days of the month to run backups.

This parameter defaults to 1.

A positive integer that represents the day of the month.

Note
titleNote:

For multiple days, use a comma-delimited list.


1

backup_monthly_enable

Boolean

Whether to enable monthly backups.

This parameter defaults to 0.

  • 1 — Enable.
  • 0 — Disable.
0

backup_monthly_retention

integer

The number of monthly backups to keep.

This parameter defaults to 1.

A positive integer.5
backup_weekly_dayinteger

Which day of the week to run weekly backups.

This parameter defaults to 1.

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

Whether to enable weekly backups.

This parameter defaults to 0.

  • 1 — Enable.
  • 0 — Disable.
0
backup_weekly_retentioninteger

The number of weekly backups to retain.

This parameter defaults to 1.

A positive integer.1

backupaccts

string

Whether to back up cPanel user accounts.

This parameter defaults to yes.

Note
titleNote:

This setting affects whether the system enables the File and Directory Restoration interface in cPanel & WHM. For more information, read the How to Manage Metadata Settings documentation.


  • yes — Back up.
  • no — Do not back up.
yes

backupbwdata

Boolean

Whether to back up bandwidth tracking data.

This parameter defaults to 1.

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

backupdays

string

Which days of the week to run daily 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
titleNote:

For multiple days, use a comma-delimited list.


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

backupdir

string

The primary backup directory.

This parameter defaults to /backup.

An absolute file path./backup

backupenable

string

Whether to enable backups.

Note
titleNote:

This setting affects whether the system enables the File and Directory Restoration interfaces in cPanel and in WHM. For more information, read the How to Manage Metadata Settings documentation.

This parameter defaults to no.

  • yes or 1 — Enable.
  • no or 0 — Disable.


no

backupfiles

Boolean

Whether to back up system files.

This parameter defaults to 1.

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

backuplogs

Boolean

Whether to back up the error logs.

This parameter defaults to 0.

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

backupmount

Boolean

Whether to mount a backup partition.

Note
titleNote:

This setting affects whether the system enables the File and Directory Restoration interfaces in cPanel and in WHM. For more information, read the How to Manage Metadata Settings documentation.

This parameter defaults to 0.

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

backupsuspendedaccts

Boolean

Whether to back up suspended accounts.

This parameter defaults to 0.

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

backuptype

string

The type of backup to create.

This parameter defaults to compressed.

  • compressed
  • uncompressed
  • incremental
compressed
check_min_free_spaceBoolean

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

Note
titleNote:

We introduced this parameter in cPanel & WHM version 64.

This parameter defaults to 0.

  • 1 — Check the free disk space on the destination server.
  • 0 — Do not check the free disk space on the destination server.
1
disable_metadatastring

Whether the Backup system will create metadata when a backup runs.

Note
titleNotes:
  • We introduced this parameter in cPanel & WHM version 70.
  • This setting affects whether the system enables the File and Directory Restoration interfaces in cPanel and in WHM. For more information, read the How to Manage Metadata Settings documentation.

This parameter defaults to no.

  • yes — Disables metadata creation.
  • no — Enables metadata creation.
no

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
force_prune_dailyBoolean

Whether to strictly enforce the value of the backup_daily_retention parameter.

Note
titleNote:

We introduced this parameter in cPanel & WHM version 64.

This parameter defaults to 0.

  • 1 — Strictly enforce the backup_daily_retention parameter.
  • 0 — Only enforce the backup_daily_retention parameter after a successful complete backup.
0
force_prune_monthlyBoolean

Whether to strictly enforce the value of the backup_monthly_retention parameter.

Note
titleNote:

We introduced this parameter in cPanel & WHM version 64.

This parameter defaults to 0.

  • 1 — Strictly enforce the backup_monthly_retention parameter.
  • 0 — Only enforce the backup_monthly_retention parameter after a successful complete backup.
0
force_prune_weeklyBoolean

Whether to strictly enforce the value of the backup_weekly_retention parameter.

Note
titleNote:

We introduced this parameter in cPanel & WHM version 64.

This parameter defaults to 0.

  • 1 — Strictly enforce the backup_weekly_retention parameter.
  • 0 — Only enforce the backup_weekly_retention parameter after a successful complete backup.
0

gziprsyncopts

string

gzip environment variables.

This parameter defaults to a blank value.

A valid string.--rysncable

keeplocal

Boolean

Whether to delete backups from the local directory.

Note
titleNote:

This setting affects whether the system enables the File and Directory Restoration interfaces in cPanel and in WHM. For more information, read the How to Manage Metadata Settings documentation.

This parameter defaults to 1.

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

linkdest

Boolean

Whether to check the rsync function for hardlink support.

This parameter defaults to 0.

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

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
maximum_restore_timeoutinteger

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

This parameter defaults to 21600.

A positive integer.21600
maximum_timeoutinteger

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

This parameter defaults to 7200.

A positive integer.7200
min_free_spacestring

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

Note
titleNote:

We introduced this parameter in cPanel & WHM version 64.


A positive number.

Note
titleNote:

If the value of the min_free_space_unit parameter is percent, the maximum value is 100.


1024
min_free_space_unitstring

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

Note
titleNote:

We introduced this parameter in cPanel & WHM version 64.


  • MB — Megabytes.
  • percent — Percent available.
MB

mysqlbackup

string

The backup method to use for MySQL® databases.

This parameter defaults to accounts.

  • accounts — Back up databases in each account's archive.
  • dir — Back up the entire MySQL directory.
  • both — Back up databases in each account's archive and the entire MySQL directory.
accounts

postbackup

Boolean

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

This parameter defaults to 0.

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

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

dieifnotmounted

Boolean

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

Note
titleNote:

We removed this parameter in cPanel & WHM version 64. 

This parameter defaults to 0.

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

usebinarypkgacct

Boolean

The backup script to use.

Note
titleNote:

We removed this parameter in cPanel & WHM version 11.42. 

This parameter defaults to 1.

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

Returns

This function only returns metadata.