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

We introduced this parameter in cPanel & WHM version 64maximum_timeout
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 finishesbackup_daily_retention

integer

The number of daily backups to retain.

This parameter defaults to 0 5.

1 — RunA positive integer.
  • 0 — Do not run.
  • 0

    backupenable

    BooleanWhether to enable 5

    backup_monthly_dates

    integer

    Which days of the month to run backups.

    This parameter defaults to 0 1.

  • 1 — Enable.
  • 0 — Disable

    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

    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

    backuptype

    string

    The type of backup to create.

    This parameter defaults to compressed.

    • compressed
    • uncompressed
    • incremental
    compressed

    backup_daily_monthly_retention

    integer

    The number of daily monthly backups to retainkeep.

    This parameter defaults to 5 1.

    A positive integer.5

    backupdays

    stringbackup_weekly_dayinteger

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

    backup_monthly_dates

    integerWhich days of the month to run backups1
    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 4.

    A positive integer that represents the day of the month..4

    backupaccts

    BooleanWhich day

    Whether to back up cPanel user accounts.

    This parameter defaults to 1.

    Note
    titleNote:

    For multiple days, use a comma-delimited list.

    1backup_weekly_dayinteger

    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.


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

    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 weekly daily backups.

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

    backup_weekly_retentionintegerThe number of weekly backups to retain
    • 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
    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 1 /backup.

    A positive integerAn absolute file path.1
    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_timeoutintegerHow long a backup will attempt to run, measured in seconds. If the backup does not succeed in this amount of time, it will stop/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

    7200

    0.

    A positive integer
    • 1 — Enable.
    7200
    • 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

    backupacctsbackuplogs

    Boolean

    Whether to back up accountsthe error logs.

    This parameter defaults to 1 0.

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

    prebackupbackupmount

    Boolean

    Whether to

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

    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

    1

    0.

    • 1RunMount.
    • 0 — Do not run mount.
    1
    0

    psqlbackupbackupsuspendedaccts

    Boolean

    Whether to back up PostgreSQL® databasessuspended accounts.

    This parameter defaults to 0.

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

    keeplocal

    backuptype

    string

    The type of backup to create.

    This parameter defaults to compressed.

    • compressed
    • uncompressed
    • incremental
    compressed
    check_min_free_spaceBoolean

    Whether to

    delete backups from the local directory.

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

    • 1 — Delete — Check the free disk space on the destination server.
    • 0 — Do not delete — Do not check the free disk space on the destination server.
    1localzonesonly
    disable_metadataBoolean

    Whether

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

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

    • 1 — Use the /var/named/domain.tld file.0 — Use dnsadmin — Disables metadata creation.
    • 0 — Enables metadata creation.
    0

    backupbwdataerrorthreshhold

    BooleanWhether to back up bandwidth tracking datainteger

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

    This parameter defaults to 1 3.

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

    dieifnotmounted

    A positive integer.3
    force_prune_dailyBoolean

    Whether to stop the backup process if the backup directory is not mountedstrictly enforce the value of the backup_daily_retention parameter.

    Note
    titleNote:

    We removed introduced this parameter in cPanel & WHM version 64. 

    This parameter defaults to 0.

    • 1StopStrictly enforce the backup_daily_retention parameter.
    • 0Do not stopOnly enforce the backup_daily_retention parameter after a successful complete backup.
    0backuplogs
    force_prune_monthlyBoolean

    Whether to

    back up the error logs.

    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.

    • 1Back upStrictly enforce the backup_monthly_retention parameter.
    • 0Do not back upOnly enforce the backup_monthly_retention parameter after a successful complete backup.
    0linkdest
    force_prune_weeklyBoolean

    Whether to

    check the rsync function for hardlink support.

    This parameter defaults to 0.

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

    backupsuspendedaccts

    BooleanWhether to back up suspended accounts

    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.

    • 1Back upStrictly enforce the backup_weekly_retention parameter.
    • 0Do not back upOnly 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

    backupdirkeeplocal

    stringThe primary backup Boolean

    Whether to delete backups from the local directory.

    This parameter defaults to /backup.

    An absolute file path./backup

    errorthreshhold

    integerThe number of times that the system will try to use the additional backup destination
    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

    3

    1.

    A positive integer
    • 0 — Delete.
    3

    backupmount

    • 1 — Do not delete.
    1

    linkdest

    Boolean

    Whether to mount a backup partitioncheck the rsync function for hardlink support.

    This parameter defaults to 0.

    • 1MountCheck.
    • 0 — Do not mount check.
    0

    mysqlbackuplocalzonesonly

    stringBoolean

    The backup method to use for MySQL® databases.Whether to use a local zone file from the /var/named/domain.tld file or dnsadmin, where domain.tld represents the target domain.

    This parameter defaults to accounts 0.

  • 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

    backup_monthly_retention

    integerThe number of monthly backups to keep.
    • 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 1 21600.

    A positive integer.521600
    check_min_free_spaceBoolean

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

    Note
    titleNote:
    integer

    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

    0

    7200.

    • 1 — Check the free disk space on the destination server.
    • 0 — Do not check the free disk space on the destination server.
    1A positive integer.7200
    min_free_spacestring

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

    This parameter defaults to 5.

    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.

    This parameter defaults to percent.

    Note
    titleNote:

    We introduced this parameter in cPanel & WHM version 64.


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

    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

    strictly enforce the value of the backup_daily_retention parameter.
    Note
    titleNote:

    We introduced this parameter in cPanel & WHM version 64.

    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 Strictly enforce the backup_daily_retention parameterBack up.
    • 0 Only enforce the backup_daily_retention parameter after a successful complete backup.
    0force_prune_weeklyBooleanWhether to strictly enforce the value of the backup_weekly_retention parameter
    • Do not back up.
    0
    remote_restore_staging_dirstring

    The directory that temporarily stores a remote backup's data during a backup restoration. The data is a compressed (.tar.gz) or uncompressed (.tar) account tarball.

    This parameter's default value is /backup.

    Warning
    titleImportant:

    The system restores backups one at a time. The backup staging directory must be large enough to contain the largest remote backup file that you wish to restore. For example, if you wish to restore three backups, sized 1.5 GB, 528 MB, and 950 MB each, your backup staging directory must be able to hold at least 1.5 GB.


    Note
    titleNote:
    • The system empties the directory after the system restores the backup.
    • We added this parameter in cPanel & WHM version 80.


    An absolute path./backup

    dieifnotmounted

    Boolean

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

    Note
    titleNote:

    We introduced removed this parameter in cPanel & WHM version 64. 

    This parameter defaults to 0.

    • 1 Strictly enforce the backup_weekly_retention parameterStop.
    • 0 Only enforce the backup_weekly_retention parameter after a successful complete backupDo not stop.
    0
    force_prune_monthly

    usebinarypkgacct

    Boolean

    Whether to strictly enforce the value of the backup_monthly_retention parameterThe backup script to use.

    Note
    titleNote:

    We introduced removed this parameter in cPanel & WHM version 6411.42. 

    This parameter defaults to 0 1.

    • 1 Strictly enforce the backup_monthly_retention parameter.0 — Only enforce the backup_monthly_retention parameter after a successful complete backup. /usr/local/cpanel/scripts/pkgacct
    • 0/usr/local/cpanel/bin/pkgacct
    0

    Returns

    This function only returns metadata.