[resolved] executing a Linux Job via Tsystem

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?

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

View solution in original post


All 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
Highlighted
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

View solution in original post

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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog