Announcement Announcement Module
Collapse
No announcement yet.
Dont manage to make SystemCommandTasklet work on Linux Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dont manage to make SystemCommandTasklet work on Linux

    Hi all,

    I have to run a linux command line in a batch, I saw the SystemCommandTasklet class and tried to use it, but without success.The job fails and no exception is logged...

    Here is the code I use :

    Code:
    <batch:job id="myJob" job-repository="jobRepository">
    		
    		<batch:step id="deleteDoublesFromFile" >
    			<batch:tasklet ref="deleteDoublesFromFileTasklet"/>
    		</batch:step>
    </batch:job>
    
    	<bean id="deleteDoublesFromFileTasklet" class="org.springframework.batch.core.step.tasklet.SystemCommandTasklet">
    		<property name="command" value="bash -c 'sort -u myFile.txt > myNewFile.txt'" />
    		<!-- 60 seconds timeout for the command to complete -->
    		<property name="timeout" value="1000" />
    	</bean>
    I tried to set the command without the 'bash -c', it failed too. The user launching the batch on linux is root, so no pb regarding the access permissions.

    What is wrong in my code?

    Thanks in advance for your help.
Working...
X