Announcement Announcement Module
Collapse
No announcement yet.
SystemCommandTasklet's setEnvironmentParams(new String[]) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SystemCommandTasklet's setEnvironmentParams(new String[])

    Hi,

    I am trying to run a Linux Shell Script using Spring-Batch SystemCommandTasklet, and the Linux Shell Script is working fine using SystemCommandTasklet.


    My problem is, I want to setEnvironmentParams(String[]) method to set some environmentParams.

    I want to set some set some environmentParams like
    JAVA_HOME=/path/to/java/dir
    CATLINA_HOME=/path/to/apache/tomcat/dir

    When I tried to set those environment params and tries to access those environment params in the shell script, I am not able to access those environment params

    like -
    Code:
               String javahome = "JAVA_HOME=/path/to/java/dir";
               String catlinahome = "CATLINA_HOME=/path/to/apache/tomcat/dir";
               systemCommandTasklet.setEnvironmentParams(new String[]{javahome ,catlinahome });
               systemCommandTasklet.setCommand("sh display_envp_script.sh")
    and in the shell script (display_envp_script.sh) -
    Code:
               echo $JAVA_HOME
               echo $CATLINA_HOME
    no output i can in the terminal. Is the process I am doing wrong or the format of setting the environmentParams is wrong. if yes please correct me.



    Thank you.
Working...
X