Pentaho

 View Only

 Behaviour of Shell job entry and shell script exit status

Glenn Jackman's profile image
Glenn Jackman posted 04-18-2024 15:53

I am using Pentaho 8.3

I have a job that uses the Shell job entry. There are success and failure branches leading out of that entry, but even if the shell scripts exits with an error status (this is Linux, so 0 is success and non-zero is failure), the job's success path is followed.

The shell script is supposed to create a CSV file that the next step reads and merges into the db. If the CSV does not exist, and the success path is followed, the potential for data loss exists.

I see in the documentation for the Shell entry (https://pentaho-public.atlassian.net/wiki/spaces/EAI/pages/371558460/Shell):

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.

How does the Shell job entry use the script's exit status?

This is the job: On non-successful run of the script, I expect "set result to error" to be the next entry executed.

Petr Prochazka's profile image
Petr Prochazka

Hi Glenn,

IMHO doc is wrong. I look at to source code and script exit code is set to a result. If exit code is not 0 then entry failed.