Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: How to tell if a "run SSH" command fails?

  1. #1
    Join Date
    Jan 2017
    Posts
    1

    Default How to tell if a "run SSH" command fails?

    Hi,

    I have been working with Pentaho for a while and now i come to a frustrating point.
    I want to know if a SSH command failed or not. first of all I tried to use the stdErr output that comes out of the box in the "Run SSH Commands" option, but as a matter of fact it is just returning if there is sdtErr or not from the command i used.
    When i use it for example a sqoop command, and stdOut will go also to the stdErr and by that make a false alarm of a failure.

    then i tried to use the exit code provided by the bash scripting, for example:
    cd FakeFolder ; echo $?
    -bash: cd: FakeFolder: No such file or directory
    1
    and then retrieve the exit code (in that case 1) and see if it is different from 0. But - sometimes pentaho will "push" the exit code, or basically any command after the original one to be written befor the stdOut of the original command.


    now i am completely out of hand - > how can i get the true exit code, or a true state of the ssh command of been successful or not?

  2. #2
    Join Date
    Jul 2009
    Posts
    476

    Default

    The Shell step looks at the return code from the script. If it's 0, the script was successful, if not, it was unsuccessful. The documentation for the step is here: http://wiki.pentaho.com/display/EAI/Shell

    In your example, your script would just be

    Code:
    cd FakeFolder
    and PDI would look at the return code of that command.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.