Page History
...
The SSHJob arguments can look like this:
Explanation:
- The workflow implements two jobs:
- Job:
execute-ssh
- Argument:
command
The value of the argument is a number of shell commands:
Code Block language bash linenumbers true echo "printing environment variables" printenv echo "adding hostname $HOSTNAME to variable remote_hostname" echo "remote_hostname=$HOSTNAME" >> $JS7_RETURN_VALUES
The last line appends a key=value pair to a temporary file that is made available from the
JS7_RETURN_VALUES
environment variable. The name being remote_hostname and the value being provided from theHOSTNAME
environment variable.
This creates an order variable with the name remote_hostname that is available to subsequent jobs and instructions in a workflow.
- Argument:
create_env_vars
- The argument is assigned the value true that specifies that for any order variables the job will create environment variables in the remote session.
- For example, an order variable with the name
date
will be made available from the environment variableJS7_VAR_DATE
.
- For example, an order variable with the name
- For details see chapter Variables.
- The argument is assigned the value true that specifies that for any order variables the job will create environment variables in the remote session.
- For the full list of available arguments see next chapter.
- Argument:
- Job:
display-result
- Argument: no arguments
- Environment Variables
- The job is assigned an environment variable with the name
REMOTE_HOSTNAME
and the value $remote_hostname which is a reference to the order variable created by the previous job.
- The job is assigned an environment variable with the name
- Script
The job script looks like this:
Code Block language bash linenumbers true echo "using workflow: $JS7_WORKFLOW_NAME" echo "running job: $JS7_JOB_NAME" echo "remote hostname: $REMOTE_HOSTNAME"
The job script makes use of the
REMOTE_HOSTNAME
environment variable that is populated from the order variable created by the previous job.
- Job:
Documentation
The Job Documentation including the full list of arguments can be found under: https://www.sos-berlin.com/doc/JS7-JITL/SSHJob.xml
...
The SSHJob can be used with a credential store to hold sensitive arguments. For use of the credential_store_*
arguments see JS7 - Use of Credential Store with JITL Jobs.
Anchor | ||||
---|---|---|---|---|
|
Display feature availability StartingFromRelease 2.3.0
Forwarding Variables
The SSHJob has access to variables from the following sources:
...
- The global variable
JS7_AGENT_TZ
is available with the remote SSH session and indicates the JS7 Agent's local time zone. - A specific variable
$dbName
is mapped to the environment variableJS7_VAR_DBNAME
in the remote SSH session. - A specific variable
$ScriptDir
is specified by a job resource with a value /usr/scripts and is declared with a workflow using the default value /var/scripts. The resulting environment variableJS7_VAR_SCRIPTDIR
will hold the value /var/scripts unless a different value is specified by the order that is added to the workflow.
Passing
...
back Variables
The command script or commands of the SSHJob executed on the remote host can pass back variables to the workflow. To this purpose the command script or commands append any number of key=value pairs to a temporary file that will be picked up by the SSHJob. Each key=value pair is passed back to the workflow and becomes an order variableTo use this feature you have to make sure that your command or command script writes the key-value-pair, which you want to have passed back to the workflow, to the temporarily created file.
Example:
The command
echo MYPARAM=
...
myTestValue >> $JS7_RETURN_VALUES
appends writes MYPARAM=myTestParam
to myTestValue
to the temporary file defined by the environment variable JS7_RETURN_VALUES
. For Unix the environment variable is specified using $JS7_RETURN_VALUES
, for Windows the syntax is %JS7_RETURN_VALUES%
.
The JS7_RETURN_VALUES
environment variable will be set implicitily during the is made available by the SSHJob during job execution. When the SSH JITL Job finishes, it reads all the Key-Value-Pairs SSHJob completes it will read the key=value pairs from the temporary files file and returns will add them as order variables to the job's outcome. The order variable MYPARAM
can be used in the outcome of the jobsubsequent jobs. When calling up the variable the syntax $MYPARAM
is used for Unix and Windows. Users should consider case-sensitive spelling of order variables.
Cancellation
The following operations are available:
...