Added by Matt Casters, last edited by Jens Bleuel on Mar 06, 2014  (view change)

Labels:

shell shell Delete
script script Delete
Enter labels to add to this page:
Wait Image 
Looking for a label? Just start typing.

Description

Use the Shell job entry to execute a shell script on the host where the job is running. For example, suppose you have a program that reads five data tables and creates a file in a specified format. You know the program works. Shell allows you to do portions of your work in Pentaho Data Integration but reuse the program that reads the data tables as needed.

The Shell job entry is platform agnostic; you can use a batch file, UNIX, and so on. When you use a Shell job entry, Pentaho Data Integration makes a Java call to execute a program in a specified location. The return status is provided by the operating system call. For example, in batch scripting a return value of 1 indicates that the script was successful; a return value of 0 (zero) indicates that it was unsuccessful. You can pass command line arguments and set up logging for the Shell job entry.

Notes:

  • Shell scripts can output text to the console window. This output will be transferred to the Kettle logging system. Doing this no longer blocks the shell script.
  • On Windows, scripts are preceded by "CMD.EXE /C" (NT/XP/2000) or "COMMAND.COM /C" (95,98).
  • The Execute a process step is similar to this job entry but can be used in a transformation.

Options

Option Description
Job entry name The name of the job entry. This name has to be unique in a single job.
Insert script
Check this option when you want to execute the script in the Script tab instead of executing the Script file name. This is also useful, when you want to execute operating system commands like dir, ls or ipconfig without giving a specific path. This option creates a temporary script in the working directory and executes it.
Note: Variables are resolved within the script when given.
Script file name The filename of the shell script to start, should include full path else ${user.dir} is used as path.
Working directory The directory that will be used as working directory for the shell script. The working directory only becomes active when the shell script starts so "Filename" should still include the full path to the script. When the field is left empty or the working directory is invalid ${user.dir} will be used as working directory.
Specify log file Enable to specify a separate logging file for the execution of this transformation
Append logfile
Enable to append to the logfile as opposed to creating a new one
Name of log file The directory and base name of the log file (for example C:\logs)
Extension of the log file The filename extension (for example: log or txt)
Include date in filename? Adds the system date to the filename. (_20051231)
Include time in filename? Adds the system time to the filename. (_235959)
Loglevel Specifies the logging level for the execution of the shell. See also the logging window in .14 Logging
Copy previous results to arguments? The results from a previous transformation can be sent to the shell script using the "Copy rows to result" step. (as arguments)
Execute once for every input row This implements looping. If the previous job entry returns a set of result rows, you can have this shell script executed once for every row found. One row is passed to this script at every execution in combination with the copy previous result to arguments. The values of the corresponding result row can then be found on command line argument $1, $2, ... (%1, %2, %3, ... on Windows)
Arguments table Specify the strings to use as arguments for the shell script.