cannot pass context param via command line on Linux

One Star

cannot pass context param via command line on Linux

Hello,
I am trying to pass context param to a Talend job (written in 4.0.3) via command-line on Linux and it is not working for me.
I am trying to pass a context.properties file as a context param, but it is picking up the Default.properties instead.
Here is how the shell script looks like:

#!/bin/sh
cd `dirname $0`
ROOT_PATH=`pwd`
/bb/util/common/java64-1.6/bin/java -Xms256M -Xmx1024M -cp classpath.jar: temp.temp_0_1.temp --context=Default --context_param context_path=context.properties
I have tried a lot of things that people have suggested on this forum but nothing seems to have worked.
Any help would be greatly appreciated.
Thanks!

Re: cannot pass context param via command line on Linux

the paramater:
--context=Default
will select the .properties file with the name "Default.properties"
if you want to select a .properties file with the name "AnythingAtAll.properties" you would change this paramater to:
--context=AnythingAtAll
the --context_param paramater is used to set paticular context varilbes from the command line. In your example, if you have a context varible in the "Default" context group named "context_path" in your job it will take the value "context.properties"
One Star

Re: cannot pass context param via command line on Linux

I read this on some other thread (http://www.talendforge.org/forum/viewtopic.php?pid=42813) and the solution to my problem was creating an environment variable and accessing it using
java.lang.System.getenv("talend_context_path")
and this works on windows and linux
thanks to nicolasdiogo !
One Star

Re: cannot pass context param via command line on Linux

hi,
I created one talend job, wic have 4 context variable. now i exported the job. after exporting job i got shell script (.sh file).
i want to pass value of context variable as manually. i know how to pass value i.e. --context_param backup_path=/root/abc .
now i still have context variable 'source,dest,failure'... how to assign value to these remain three???
Regards,
Akshath Hegde
Moderator

Re: cannot pass context param via command line on Linux

Hi Akshath,
Could you please stick to your topic Forum:33841.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.