Hitachi Vantara Pentaho Community Forums
Results 1 to 6 of 6

Thread: Environment variables

  1. #1
    Join Date
    Jul 2009
    Posts
    18

    Question Environment variables

    Hi guys,

    I'm integrating a new project in the company where I work, and they are using the Kettle.
    I'm completely new in this tool and I have some questions.

    I'm creating a Job where I have a configuration file and I'm reading this file to get some information to connect in a remote computer to get a file.

    I'm doing this with a shell script. I get the values and put it in environment variables to use in a "Get a file with SFTP", but when the Kettle will connect with the remote computer, ocurr this error:

    INFO 23-07 18:44:38,234 - Get file - Start of SFTP job entry
    ERROR 23-07 18:44:38,236 - Get file - We can not find target folder ${JOB_DIR_OUT}!

    The Kettle isn't getting the environment variable.

    If I get the variable with %%JOB_DIR_OUT%%, a java exception is triggered.

    What I have doing to get the environment variable and use in the SFTP connection?

    I put bellow the shell script to set the variables:

    Code:
    #!/bin/ksh
     
    if ! [ -f X22J_SFTPFileTransfer_input.cfg ]; then
       exit 1
    fi
     
    export JOB_IP=`grep IP X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    export JOB_USER=`grep USER X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    export JOB_PASSWD=`grep PASSWORD X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    export JOB_DIR_IN=`grep DIR_IN X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    export JOB_DIR_OUT=`grep DIR_OUT X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    export JOB_DIR_BKP=`grep DIR_BKP X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`

  2. #2
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    You need to pass parameters to the java command line options with -DKEY=value or use Named parameters.

  3. #3
    Join Date
    Jul 2009
    Posts
    18

    Default

    Man...

    I tried pass the parâmeters to the JVM with the script, like this:

    Code:
    java -DJOB_IP=`grep IP X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    java -DJOB_USER=`grep USER X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    java -DJOB_PASSWD=`grep PASSWORD X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    java -DJOB_DIR_IN=`grep DIR_IN X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    java -DJOB_DIR_OUT=`grep DIR_OUT X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    java -DJOB_DIR_BKP=`grep DIR_BKP X22J_SFTPFileTransfer_input.cfg | cut -d= -f2`
    But it isn't work. The JVM asks to execute a class or a jarfile.

    Exists some generic class to use in this case?

    I can't use the named parameters because we have a script to run all jobs in the server, so I can't modify it to pass the parameters in the command line.
    Last edited by kamikase; 07-24-2009 at 03:00 PM.

  4. #4
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    The options are correct. You can add them all to the OPT variable in the pan/kitchen/carte/spoon scripts provided by the Kettle project.

  5. #5
    Join Date
    Jul 2009
    Posts
    18

    Default

    Ok, thanks man.

    I will try here and when I finish it I will post if it works or not.

  6. #6
    Join Date
    Nov 1999
    Posts
    9,729

    Default

    Obviously it works, many other default environment variables are already passed to PDI.

    If you prefer not to edit anything, I advise you to use named parameters.

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.