Run Shell Script
Runs a Linux-like shell command: use it for Unix-like OS tasks.
To prevent collisions between Unix Shell variables format and workflow expression format, this task uses a different expression markup: $%expression()% instead of the regular ${expression()} markup.
|
Name | Type | Description | Expression support |
---|---|---|---|
Command |
mandatory |
Command or file name to execute. |
semi-expression |
Interpreter |
optional |
Defines the interpreter for processing the |
none |
Working Dir |
optional |
Working directory.
Default value: the current Java process directory (usually value of |
semi-expression |
Wait For |
optional |
Defines whether the task should wait until the job finishes.
Default value: |
none |
Expected Return Codes |
optional |
Comma-separated list of integer values representing valid return codes of the command.
Default: |
none |
Log Start Stop |
optional |
If set to |
none |
How is the command processed?
-
The possible variable mapping replacements are performed.
-
The entire command value is copied to the temporary script file (located in the task resources directory).
-
The temporary script file is executed using the specified interpreter.
-
The read return value is returned.
Wait For modes
-
waitFor=true
-
The task waits until the run command is done.
-
The returned code is then compared against
expectedReturnCodes
. -
If expected codes do not contain the returned code, the task fails.
-
-
waitFor=false
-
The task only starts up the command and then terminates immediately.
-
That means that there is no valuable return code to compare against
expectedReturnCodes
, therefore this comparison is skipped. -
The task finishes in OK state and the result of the task is set to
-1
("unknown" value).
-
Predefined variables
-
SCRIPT_RESULT_CODE: Contains the result code returned by the script. The variable is set only if:
-
The task was run with
waitFor=true
. -
The task has not failed with exception.
-
<executable class="com.ataccama.adt.task.exec.EwfShellScriptTask">
<command>${COMMANDS_PATH}/$%shellCmdVar%</command>
<workingDir>/home/someuser</workingDir>
<waitFor>true|false</waitFor>
<interpreter>/bin/bash</interpreter>
<expectedReturnCodes>0,1</expectedReturnCodes>
<logStartStop>true|false</logStartStop>
</executable>
This sample also illustrates the usage of variable mapping $%…%
, which is specific for this task.
Assuming that shellCmdVar
contains th evalue someScript.sh
, the command from the sample would be translated to the following:
${COMMANDS_PATH}/someScript.sh
Was this page useful?