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_password - Developer Documentation - cPanel Documentation
Child pages
  • UAPI Functions - Backup::fullbackup_to_scp_with_password
Skip to end of metadata
Go to start of metadata

Description

This function creates a full backup to a remote server via the secure copy protocol (scp) command with a password. The system creates a file in the backup-MM.DD.YYYY_HH-mm-ss.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_password?host=example.com&port=22&username=username&password=luggage123456&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 with the scp command.
$fullbackup = $cpanel->uapi(
	'Backup', 'fullbackup_to_scp_with_password',
	array(
		'host'					 => 'example.com',
		'port'					 => '22',
		'username'				 => 'username',
		'password'				 => 'luggage123456',
		'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 with the scp command.
my $Backup_fullbackup = $cpliveapi->uapi(
    'Backup', 'fullbackup_to_scp_with_password',
	{
		'host'			 		 => 'example.com',
		'port'			 		 => '22',
		'username'				 => 'username',
		'password'				 => 'luggage123456',
		'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_password host=example.com port=22 username=username password=luggage123456 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_password",
   "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
usernamestring
Required

The remote server account's username.

A valid remote server username.username
passwordstring
Required

The remote server account's password.

A valid remote server password.luggage123456
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