Hitachi Vantara Pentaho Community Forums
Results 1 to 7 of 7

Thread: pass env variables into job via kitchen from cmd line

  1. #1

    Default pass env variables into job via kitchen from cmd line

    I need to pass variables into a job via kitchen.sh from the command line.
    I wish to avoid editing kitchen.sh to set the OPTs using -Dvarname=value, since its not practical to have a dedicated kitchen.sh for every job.
    Whats the best way to pass parameter value into a job from command line without editing kitchen.sh?

    Thanks for any help!
    -A

  2. #2
    Join Date
    May 2006
    Posts
    4,882

    Default

    Use positional arguments on the kitchen command line and then use the system info step to get them... Before 3.0 you were not able to get 10 arguments, as of 3.0 it works as expected.

    There are other metfhods as well ;-)

    Regards,
    Sven

  3. #3

    Default

    Thanks Sven,
    Since I will be using 2.5.2 for some more time, can you please highlight what other methods are.

    -Al

  4. #4
    Join Date
    May 2006
    Posts
    4,882

    Default

    What some people do is:

    - make a transformation that reads a text file of values X=Y (using = as separator) and ends up in a modified javascriprt setting the key/values up variables.
    - Pass the name to that file in as positional argument

    Depending on which file you then supply you can change the variable values.

    Regards,
    Sven

  5. #5

    Default

    Thanks for your help.
    I created a myown_kitchen.sh that checks for cmd line args that match -D* and appends those into java's opts.

    -Al

  6. #6
    Join Date
    Jul 2007
    Posts
    247

    Default

    Sounds like a good idea

    Could you please provide a sample?


    Thanks in advance,
    Ben

  7. #7
    Join Date
    Jun 2008
    Posts
    7

    Default

    I you use bash, add this in the kitchen.sh script before the final line that start java:


    OPTERR=0
    while getopts "D:" options; do
    if [ -n "$OPTARG" ]; then
    OPT="$OPT -D$OPTARG"
    fi
    done

    You can then add your options to command line with the -D option, like you would do with java, ie:

    kitchen.sh ..... -DMYVAR=MYVALUE
    Last edited by oliviert; 06-19-2008 at 11:20 AM. Reason: uncomplete

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.