User Community Service Desk Downloads
If you can't find the product or version you're looking for, visit support.ataccama.com/downloads

Run Shell Script

Run Shell Script icon

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 command value. Default: /bin/sh.

none

Working Dir

optional

Working directory. Default value: the current Java process directory (usually value of usr.dir property).

semi-expression

Wait For

optional

Defines whether the task should wait until the job finishes. Default value: true.

none

Expected Return Codes

optional

Comma-separated list of integer values representing valid return codes of the command. Default: 0.

none

Log Start Stop

optional

If set to true, the task writes start and stop marks to the standard output log (STDOUT). Default: true.

none

How is the command processed?

  1. The possible variable mapping replacements are performed.

  2. The entire command value is copied to the temporary script file (located in the task resources directory).

  3. The temporary script file is executed using the specified interpreter.

  4. The read return value is returned.

Wait For modes

  • waitFor=true

    1. The task waits until the run command is done.

    2. The returned code is then compared against expectedReturnCodes.

    3. If expected codes do not contain the returned code, the task fails.

  • waitFor=false

    1. The task only starts up the command and then terminates immediately.

    2. That means that there is no valuable return code to compare against expectedReturnCodes, therefore this comparison is skipped.

    3. 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.

Sample
<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?