Using the FTP Definition Type
The FTP process type allows you to specify jftp
commands in a process that can then be executed on Platform Agents. The same process can be used across platforms without the need adapt the syntax to the target platform.
The following default FTP processes allow you to perform basic actions.
Name | Description |
---|---|
System_FTP_delete | Deletes a file from the FTP server. |
System_FTP_get | Gets a file from the FTP server. |
System_FTP_list | Lists the contents of a directory on the FTP server. |
System_FTP_mget | Retrieves files matching a pattern from the FTP server. |
System_FTP_mkdir | Creates a directory on the FTP server. |
System_FTP_mput | Uploads files matching a pattern to the FTP server. |
System_FTP_put | Uploads a file to the FTP server. |
System_FTP_rmdir | Removes a directory from the FTP server. |
Security
If the RunAsUser property of a process is set, that user is used to launch jftp
. If not, the default user of the Platform Agent will be used.
If the RemoteRunAsUser property of a process is set, that user is used to connect to the remote FTP server. This lets you use credentials with jftp
.
You can also use the following process parameters to specify users.
JCS_USER
: OS user. This parameter takes precedence over Run As User.JCS_ENDPOINT
: The endpoint forJCS_USER
.JCS_REMOTE_USER
: The FTP user. This parameter takes precedence over Remote Run As User.JCS_REMOTE_ENDPOINT
: The endpoint forJCS_REMOTE_USER
.
Warning: If JCS_USER
, JCS_REMOTE_USER
, JCS_REMOTE_PASSWORD
, or JCS_PASSWORD
contain a password, make sure you set the Password property on the parameter, or the password will be stored and displayed in clear text.
Note: Process parameters take precedence over the [Remote] Run As User fields. This lets you use generic credentials. Use JCS_REMOTE_ENDPOINT
when the endpoint in the Run As User field should only be used to find a credential.
The syntax for the Run As User / Remote Run As User fields and JCS_USER
/ JCS_REMOTE_USER
parameters is as follows.
[[{virtual}:]user[[/password][[@endpoint]
You can specify defaults on the Process Server with Process Server parameters.
Warning: The following special characters in passwords will cause problems: @, /, :
Note: JCS_USER
behaves differently on Windows in RunMyJobs version 9 than did JCS_NTUSER
in version 7 and earlier. JCS_USER
defaults to local accounts (when no domain is specified), whereas JCS_NTUSER
defaults to domain accounts.
Using Credentials
When you use credentials, the connection is already established when the process source is evaluated. This means that you cannot specify a non-standard port in the process source while using credentials. In this case you can specify the port in the Endpoint of the credential as follows.
[{virtual}:]<user>@<endpoint>:<port>
or jdoe@ftp.example.com:2021
Examples
The following examples illustrate how to specify users.
JCS_USER
set tojdoe
: Alogin
credential forjdoe
must exist for the endpoint specified by the RemoteHostName Process Server parameter. If the credential does not exist or is not valid, the process will fail.JCS_REMOTE_USER
set tojdoe@ftp.example.com
: Alogin
credential forjdoe
must exist for endpointftp.example.com
. If the credential does not exist or is not valid, the process will fail.JCS_REMOTE_USER
set to{virtual}:ftp_user@ftp.example.com
: Alogin
credential for virtual userftp_user
must exist for endpointftp.example.com
; the username of this credential can be set totestuser
in the Test environment,devuser
in the development environment, andjdoe
in the production environment. There is thus no need to change the process if you promote it from one environment to the other. If the credential does not exist or is not valid, the process will fail.- Run As User set to
jdoe@MSLN_UNIXS3:sjobs@MSLN_UNIXS3
: First, the credential forjdoe
will be used. If this fails, the credential forsjobs
will be used. If both fail, the process will go into Error status. Note that in this example, the RemoteHostName Process Server parameter must be set toMSLN_UNIXS3
. - Run As User is set to
jdoe/tiger@MSLN_UNIXS3
: No credential lookup is done, because the password is provided. - Another example using multiple parameters:
JCS_USER
is set tojdoe/tiger
JCS_ENDPOINT
is set toMSLN_UNIXS3
Syntax
You can create your own FTP processes using the following syntax.
get <options> <outfile> <infile>
mget <options> <pattern> <localdir>
put <options> <infile> <outfile>
mput <options> <pattern> <remotedir>
list <options> <directory>
delete <options> <file>
mkdir <options> <directory>
rmdir <options> <directory>
quote <options> <command>
include <options> <includefile>
<options> := [ [ -ascii | -binary ] |<p />
-use_cwd |<p />
-pasv |<p />
-port <port_number> |<p />
-secretfile <file> |<p />
<options> ]
Examples
The following sections provide examples of how to use the FTP Definition Type.
Specifying Username, Password, and Host
The Remote Run As User is set to jsmith/htimsj@ftp.example.com
. The Source is set to the following.
list pub/shared_cars
Note: The password will be obscured once the Process Definition is saved.
Using a Credential
The Remote Run As User is set to jsmith@ftp.example.com
. The Source is set to the following.
list pub/shared_cars
Retrieving a File
The Remote Run As User is set to jsmith@ftp.example.com
. The Source is set to the following.
list pub/shared_cars/
get pub/shared_cars/Application_Example.car /tmp/Application_Example.car
mget pub/shared_cars/JobDefinition_* /tmp/
Note: For more information and additional examples, see jftp
.