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

 

Description

This function lists the FTP server's active sessions.

Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Ftp/list_sessions

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.
 
// List current active FTP sessions.
$list_active_sessions = $cpanel->uapi(
    'Ftp', 'list_sessions'
);

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.
 
# List current active FTP sessions.
my $list_active_sessions = $cpliveapi->uapi(
    'Ftp', 'list_sessions',
);

Note:

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

 

 cPanel Template Toolkit
<!-- List current active FTP sessions. -->
[% execute( 'Ftp', 'list_sessions' ); %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 

 Command Line
uapi --user=username Ftp list_sessions

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. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{
  "messages": null,
  "errors": null,
  "status": 1,
  "data": [
    {
      "pid": "6735",
      "status": "IDLE",
      "file": "",
      "user": "username@example.com",
      "cmdline": "pure-ftpd (IDLE)",
      "host": "localhost",
      "login": "Tue Apr 23 16:23:23 2013"
    }
  ],
  "metadata": {
    "transformed": 1
  }
}


Note:

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

   

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
pidstringThe session's PID.

An integer value that represents the FTP session's process ID.

6735
statusstringThe session's status.
  • IDLE — The session is connected, but idle.
  • DL — A download is in progress.
  • UL — An upload is in progress.
IDLE
filestringThe file that the session is processing.
  • A valid filename.
  • A blank value, if the session is idle.
file.txt
userstringThe FTP account username.The username for an FTP account on the cPanel account.ftpaccount
cmdlinestringProcess information.Information about the FTP process, from the ps (process status) command.pure-ftpd (IDLE)
hoststringThe hostname that connected to the FTP server.A valid hostname.localhost
loginstringThe FTP session login time.The time at which the FTP session started, in human-readable format.Tue Apr 23 16:23:23 2013