jgetfile, jtool getfile

You can use jgetfile to retrieve a file from the RunMyJobs server or a Platform Agent.

Note: For installation instructions, see jtool.

Syntax

Copy
jgetfile  [-h|-?|-help] [-l <loglevel>] [-f <logfile>] -j|-job-context|<connfile> -o|-output <output-file>
          -s|-serverpath <path> [-a|-append] [-direct only|fallback|never] [-r|-retries <retries>]
          [-d|-delay <delay>] [-retry-server ...] [-retry-other ...] [-[no]compression] [-[no]verbose]
          [-[no]protect] [-tempdir <dir>]

Arguments Default Description
-h, -?, -help

Shows the help.
-l <loglevel> ${JCS_LOGLEVEL:-info} Sets the log level.
-f <logfile> ${JCS_LOGFILE:-stderr} Logs to a file instead of stdout and stderr.
-j, -job-context, <connfile>

Specifies that the jevent should run in a job context. If this is not the case, a connection file <connfile> is required.
-o, -output <output-file>

The output file.
-s, -serverpath <path>

Specification or path on server.
-a, -append

Appends retrieved output to any existing file.
-direct only|fallback|never fallback Retrieves a file directly from a Platform Agent.
-r, -retries <retries> 10 The number of retries.
-d, -delay <delay> 10 The retry delay.
-retry-server ... 300-550,!400,!401,!500 Retry if the status code is in this list, if the answer is from RunMyJobs or a Platform Agent.
-retry-other ... 300-550 Retry if the status code is in this list, if the answer is NOT from RunMyJobs or a Platform Agent.
-[no]compression

Allows or disallows compression.
-[no]verbose

Shows progress during upload (in the job description, in the job context).
-[no]protect

Causes the process to fail if the connection is not encrypted with HTTPS. A secure connection between the Platform Agent and the target server should be set up prior to using this parameter.
-[no]convert

Converts file from --network to --filedata character set.
-tempdir <dir>

Temporary directory for file during download.

Specifying Files

The -s switch accepts the following syntax.

  • "<step>, Job <x>:<file>": Retrieve the file named <file> from Chain Process number <x> of the Step named <step> in the Chain.
  • "<jobid>:<file>": Retrieve the output file named <file> from the process with ID <jobid>.
  • "parent:<file>": Retrieve the output file named <file> from the parent.
  • "/document/<full_path>": Retrieve the contents of the document using the document's full path.
  • "/event/<EventId>": Fetch the file content that raised <EventId>.
  • "/job/<jobid>/<file>": Equivalent to <jobid>:<file>.
  • "/library/<Partition>.<Name>/resource/<path>": Download an individual resource (file) from one of the sources in the library.
  • "/library/<Partition>.<Name>/jar/<Name>": Download an entire .jar file from the library.
  • "/processserver/<Partition>.<Name>/<path>": Fetch the content of <path> on the Process Server <Partition>.<Name>. This works for Platform Agent Process Servers. The <path> must either be inside DataRootDirectory, or in a list of allowed sources defined on the Platform Agent itself (net configuration file server_root).

Note: parent does not work in Chains because as the parent of a Chain Process is always a Step, which usually does not produce output.

TLS Arguments

The arguments require the -protect argument.

Argument Environment Variable Description
-tlsv1_3, -tls13 JCS_SSL_METHOD=tlsv1_3 Use TLS v1.3 secured connection.
-tlsv1_2, -tls12 JCS_SSL_METHOD=tlsv1_2 Use TLS v1.2 secured connection.
-tlsv1_1, -tls11 JCS_SSL_METHOD=tlsv1_1 Use TLS v1.1 or better secured connection.
-tlsv1, -tls JCS_SSL_METHOD=tlsv1 Use TLS v1.0 or better secured connection (default).
-sslv3, -ssl JCS_SSL_METHOD=sslv3 Use SSL v3 or better secured connection.
-cipherlist <text> JCS_SSL_CIPHERLIST Set list of available ciphers.
-passphrase <text> JCS_SSL_PASSPHRASE Set passphrase for private key.
-key <file> JCS_SSL_KEYPATH Set private key.
-cert <file> JCS_SSL_CERTIFICATE_PATH Set public certificate.
-ca <file|path> JCS_SSL_TRUSTED_CERTIFICATE_FILE Trusted CA certificates path or file.
-[no]verify JCS_SSL_VERIFY_CERT (Do not) verify peer (server or client) certificate.
-verify-names <namelist> JCS_SSL_VERIFY_SERVER_NAMES, JCS_SSL_VERIFY_CLIENT_NAMES Verify peer (server or client) certificate hostname against list.

Securing Connections

If you transfer files between Platform Agents and wish to use the parameters, make sure the Platform Agents and RunMyJobs server are configured for secure communication. When you transfer files between the Platform Agent and the central server in on-site environments, you have to configure the central server for secure communication.

For more information, see:

Proxy Setting Environment Variables

The following environment variables are used to retrieve proxy server connection details.

  • HTTP_PROXY: The URL of the proxy server. For example: https://proxy.example.com:3128.
  • PROXY_USER: The user for the proxy server. This value is ignored if HTTP_PROXY is not set.
  • PROXY_PASSWORD: The password for the proxy user. This value is ignored if HTTP_PROXY is not set.
  • NO_PROXY: Enforces a direct connection.

These environment variables override the settings in the connection file for all tools that connect to the central Redwood server.

Configuration

Make sure the RunMyJobs server is accessible from the host where jgetfile is run. If you want to use the -protect switch, you must configure the Platform Agent HTTP servers to use HTTPS and trust one anothers' certificates. If you have an on-site installation, make sure the central RunMyJobs server also trusts the certificate.

Process Server Parameters and Environment Variables

Use the ${<name>} syntax to specify Process Server parameter values. Note that if you shell interprets ${<val>}, you must escape the expression according to your shell. The special ${LISTALL} variable contains a list of all environment variable and Process Server parameters. Any Process Server parameter that has remote set to true can be accessed in this way.

This can be used outside of job-context, however, only environment variables are available.

Note: jgefile expects a correctly escaped environment variable name for your shell. Make sure the shell does not evaluate the variable. See the examples below.

Examples

This example retrieves a file named stdout.log from the first Chain Process of Step 2 in a Chain.

Copy
jtool getfile -j -o stdout.new -s "Step 2, Job 1:stdout.log"

This example retrieves the stdout.log file from the process with ID 123.

Copy
jtool getfile -j -o stdout.new -s 123:stdout.log

This example retrieves the output file from the parent job.

Copy
jtool getfile -j -o stdout.new -s parent:stdout.log

This example retrieves several files from different Chain Processes in the same Chain and appends them to one big file.

Copy
jtool getfile -j -o stdout.new -s "Step 1, Job 1:stdout.log"
jtool getfile -j -a -o stdout.new -s "Step 1, Job 2:stdout.log"
jtool getfile -j -a -o stdout.new -s "Step 2, Job 1:stdout.log"
jtool getfile -j -a -o stdout.new -s "Step 2, Job 2:stdout.log"
jtool getfile -j -a -o stdout.new -s "Step 2, Job 3:stdout.log"

This example retrieves the file with the specified path.

Copy
jgetfile -j -o document.txt -s '/document/doc:MyPartition:/MyPartition2.SomeApplication/A_Document.txt'

This example retrieves the file that triggered the file event with raise sequence 1234.

Copy
jgetfile -j -o input.txt -s "/event/1234"

This example retrieves the class file for the class com.redwood.scheduler.custom.functions.Utilities in library MyPartition.Custom_Utilities.

Copy
jgetfile -j -o Utilities.class -s "/library/MyPartition.Custom_Utilities/resource/com/redwood/scheduler/custom/functions/Utilities.class"

This example retrieves the .jar file named Myjar with DescriptionImport_jar.jar (the filename of the uploaded file) in library MyPartition.Custom_Utilities.

Copy
jgetfile -j -o Myjar.jar -s "/library/MyPartition.Custom_Utilities/jar/Myjar"

This example retrieves a file from Process Server myPartition.MSLN_UNIXS7 and puts it into a directory named after the InputDirectory Process Server parameter. The file server_root contains this line: c:\\redwood.

Copy
jgetfile -j -o '${InputDirectory}'/document.txt -s "/processserver/myPartition.MSLN_WINS7/C:\redwood\myfile.txt"

An alternative to the above example, with forward slashes as path separator. This will work on Windows.

Copy
jgetfile -j -o ${BustWatchDirectory}\document.txt -s "/processserver/myPartition.MSLN_WINS7/C:/redwood/myfile.txt"
Copy
jgetfile -j -o ${BustWatchDirectory}\document.txt -s "/processserver/myPartition.MSLN_UNIXS7//redwood/myfile.txt"