Our documentation is getting an overhaul! We would like your input! Click here to take a look at the beta launch of our new documentation site! Only cPanel & WHM version 82 documentation exists on our beta at this time. 84 will be added to the new site soon! Leave your feedback here: https://go.cpanel.net/docsfeedback
UAPI Functions - Backup::fullbackup_to_scp_with_key - Developer Documentation - cPanel Documentation
Child pages
  • UAPI Functions - Backup::fullbackup_to_scp_with_key
Skip to end of metadata
Go to start of metadata

Description

This function creates a full backup to a remote server with a private SSH key via the secure copy protocol (scp) command. The system creates a file in the backup-MM.DD.YYYY_HH-mm-ss_username.tar.gz filename format.

Note:

In this filename format:

  • YYYY represents the year.
  • MM represents the month.
  • DD represents the date.
  • HH represents the hour.
  • mm represents the minute.
  • ss represents the second.
  • username represent's the account's username.

Example


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Backup/fullbackup_to_scp_with_key?host=example.com&port=22&key_name=examplesshkey&key_passphrase=123456luggage&directory=%2Fuser&email=username%40example.com


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.

// Perform a full backup of the account's files via scp with a private SSH key.
$fullbackup = $cpanel->uapi(
	'Backup', 'fullbackup_to_scp_with_key',
	array(
		'host'					 => 'example.com',
		'port'					 => '22',
		'key_name'				 => 'examplesshkey',
		'key_passphrase'		 => '123456luggage',
		'directory'				 => '/user'
		'email'					 => 'username@example.com',
);


Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Perform a full backup of the account's files via scp with a private SSH key.
my $Backup_fullbackup = $cpliveapi->uapi(
    'Backup', 'fullbackup_to_scp_with_key',
	{
		'host'			 		 => 'example.com',
		'port'					 => '22',
		'key_name'				 => 'examplesshkey',
		'key_passphrase'		 => '123456luggage',
		'directory'				 => '/user'
		'email'					 => 'username@example.com',
	}
);


Note:

For more information, read our Guide to the LiveAPI System.

 Command Line
uapi --user=username Backup fullbackup_to_scp_with_key host=example.com port=22 key_name=examplesshkey key_passphrase=123456luggage directory=/user email=username@example.com


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
   "apiversion":3,
   "module":"Backup",
   "func":"fullbackup_to_scp_with_key",
   "result":{
      "warnings":null,
      "errors":null,
      "metadata":{
 
      },
      "status":1,
      "data":{
         "pid":"2857"
      },
      "messages":null
   }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample
hoststring

Required

The remote server's hostname or IP address.

A valid hostname or IP address.example.com
portinteger
The port to use during the transfer.
This value defaults to 22.

A valid port number.

22
key_namestring

Required

The SSH key's name.

Notes:

A valid string.
examplesshkey
key_passphrasestring

Required

The SSH key's password.

A secure string of four characters or more.123456luggage
directorystring

The directory on the remote server that will store the backup.

This value defaults to the remote server account's default login directory.

A valid directory./user
emailstring

The email address to receive a confirmation email when the backup completes.

Note:

The system does not provide confirmation if you do not pass this parameter.

This value defaults to undef.

A valid email address.username@example.com

Returns

ReturnTypeDescriptionPossible valuesExample
pidstringThe backup's process identifier.A valid PID.2857