jgetfile, jtool getfile
This platform agent tool is used to retrieve a file from the central Redwood Server or a platform agent.
Syntax
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 | Show this help and exit | |
-l <loglevel> | ${JCS_LOGLEVEL:-info} | Set the logging level; defaults to environment variable ${JCS_LOGLEVEL} or info when the environment variable is not set. |
-f <logfile> | ${JCS_LOGFILE:-stderr} | Log to file instead of stderr; defaults to environment variable ${JCS_LOGFILE} or stderr when the environment variable is not set. |
-j, -job-context, <connfile> | Obtain environment from job-context or use a jsecret connection file | |
-o, -output <output-file> | Output file | |
-s, -serverpath <path> | Specification or path on server. | |
-a, -append | Append retrieved output to any existing file | |
-direct only|fallback|never | fallback | Retrieve file directly from agent for file originating from platform agent |
-r, -retries <retries> | 10 | Retries |
-d, -delay <delay> | 10 | Retry delay |
-retry-server ... | 300-550,!400,!401,!500 | Retry when statuscode is in this list when answer is from server or agent |
-retry-other ... | 300-550 | Retry when statuscode is in this list when answer is not from server or agent |
-[no]compression | Whether to allow or disallow compression | |
-[no]verbose | Show progress during upload (in job description in job context) | |
-[no]protect | Fail if connection is not encrypted (using HTTPS) - the secure connection between the platform agent and the target server should be set-up prior to using this parameter. | |
-[no]convert | Convert file from --network to --filedata characterset | |
-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>
of 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 from the library."/processserver/<Partition>.<Name>/<path>"
- fetch the content of<path>
on the process server<Partition>.<Name>
. Only works for platform agent process servers. The<path>
must either be inside DataRootDirectory, or in a list of allowed sources defined on the agent itself (net configuration file server_root).
note
parent
does not work in chains, as the parent of a chain process is always the 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
When you transfer files between agent and wish to use the parameters, you have to ensure the agents and central server are configured for secure communication. When you transfer files between the agent and the central server in on-site environments, you have to configure the central server for secure communication.
Proxy Settings
The following environment variables are used to retrieve proxy server connection details:
HTTP_PROXY
- The URL to the proxy server,https://proxy.example.com:3128
PROXY_USER
- The user for the proxy server, ignored ifHTTP_PROXY
is not setPROXY_PASSWORD
- The password for the proxy user, ignored ifHTTP_PROXY
is not setNO_PROXY
- Enforce a direct connection
note
These environment variables override the settings in the connection file.
Configuration
You must ensure that the central server is accessible from the host where jgetfile
is run. If you wish to use the -protect
switch, you must configure the platform agent HTTP servers to use HTTPS and trust each-others certificate; if you have an on-site installation, you must ensure the central Redwood server also trusts the certificate.
Process Server Parameters and Environment Variables
You use the ${<name>}
syntax to specify process server parameter values; note that if you shell interprets ${<val>}
then you will have to 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, you must ensure the shell does not evaluate the variable. See examples are available below.
Examples
Retrieve a file named stdout.log
from the first chain process of step 2 in the chain
jtool getfile -j -o stdout.new -s "Step 2, Job 1:stdout.log"
Retrieve the stdout.log
file from the process with jobid 123
jtool getfile -j -o stdout.new -s 123:stdout.log
Retrieve the output file from the parent job
jtool getfile -j -o stdout.new -s parent:stdout.log
Retrieve several files from different chain processes in the same chain and append them to one big file
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"
Retrieve a document with the path
jgetfile -j -o document.txt -s '/document/doc:MyPartition:/MyPartition2.SomeApplication/A_Document.txt'
Retrieve the file that triggered file event with raise sequence 1234
jgetfile -j -o input.txt -s "/event/1234"
Retrieve the class file for the class com.redwood.scheduler.custom.functions.Utilities
in library MyPartition.Custom_Utilities
jgetfile -j -o Utilities.class -s "/library/MyPartition.Custom_Utilities/resource/com/redwood/scheduler/custom/functions/Utilities.class"
Retrieve the JAR file named Myjar
with Description Import_jar.jar
(the filename of the uploaded file) in library MyPartition.Custom_Utilities
jgetfile -j -o Myjar.jar -s "/library/MyPartition.Custom_Utilities/jar/Myjar"
Retrieve a file from process server myPartition.MSLN_UNIXS7
and put it into a directory named after the InputDirectory
process server parameter, the file server_root
contains this line: c:\\redwood
.
jgetfile -j -o '${InputDirectory}'/document.txt -s "/processserver/myPartition.MSLN_WINS7/C:\redwood\myfile.txt"
Alternative with forward slashes as path separator, works on MS Windows as well
jgetfile -j -o ${BustWatchDirectory}\document.txt -s "/processserver/myPartition.MSLN_WINS7/C:/redwood/myfile.txt"
jgetfile -j -o ${BustWatchDirectory}\document.txt -s "/processserver/myPartition.MSLN_UNIXS7//redwood/myfile.txt"