One Star

[resolved] executing a Linux Job via Tsystem

Hello
we need to execute a Linux job using Talend
when we pass the commands below directly on the Linux server everything goes well:
su - openrate
/opt/AfmWS/bin/loadrefdata.sh /opt/ftproot/AFM_ProductsOffersSales_TEST >> /opt/AfmWS/logs/refdata-20120411.log
To execute these commands via Talend, we use the component TSystem. We set the LINUX server in the TARGET EXEC using the following command :
"sh /opt/AfmWS/bin/loadrefdata.sh \"/opt/ftproot/AFM_ProductsOffersSales_TEST\" >> \"/opt/AfmWS/logs/refdata-20120411.log\""
At the execution, Talend returns no error but nothing happens on the server
To remove all problem JOB SERVER, we successfully executed the following command via the TSystem :
"etc/init.d/afmpricing stop"
For information we use a Linux CentOS 5.6 V
any help please?
1 ACCEPTED SOLUTION

Accepted Solutions
One Star

Re: [resolved] executing a Linux Job via Tsystem

Hi
Got it. TIS 4.2 is not the newest version.
Don't worry. We have workaround to solve it.
Edit the command in tSystem as the following pattern.
new String[]{"/bin/bash","-c","cat /home/pedro/test >> /home/pedro/log"}
Regards,
Pedro
5 REPLIES
One Star

Re: [resolved] executing a Linux Job via Tsystem

Hi
tSystem uses java.lang.Runtime.exex() method to execute linux command. And this is a well-known issue about pipes. Because '>>' is not an argument here.
So here is a workaround for ">>".
Besides, for your job, I think you can use two tSystem components here. One is to call JobName_run.sh.
The other is to do pipes.
Regards,
Pedro
One Star

Re: [resolved] executing a Linux Job via Tsystem

Hi
Thanks for your answer
But in the TIS we have (version 4.2), we have no radio button "use array command" in the component TSYTEM.
how to modify the component? or how to bypass the probleme?
Thanks
atlas27
One Star

Re: [resolved] executing a Linux Job via Tsystem

Hi
Got it. TIS 4.2 is not the newest version.
Don't worry. We have workaround to solve it.
Edit the command in tSystem as the following pattern.
new String[]{"/bin/bash","-c","cat /home/pedro/test >> /home/pedro/log"}
Regards,
Pedro
One Star

Re: [resolved] executing a Linux Job via Tsystem

Hi,
Thanks for your help
we have resolved the problem with the following command in the component TSYSTEM (with cheking the radio button "use home directory" specify "\" in the directory )
new String[]{"opt/AfmWS/bin/loadrefdata.sh","/opt/ftproot/AFM_ProductsOffersSales_TEST"}
And we use a TFILEOUTPUTDELIMITED to recover the log file
Thanks
Best Regards
atlas27
One Star

Re: [resolved] executing a Linux Job via Tsystem

Hi Atlas27
Great. Thanks for your feedback.
Feel free to ask any question here.
Regards,
Pedro