Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Issue while running Linux commands from tSystem

Hi,
I am writing a command: "echo Hello >> /root/test.txt" in a tSystem component of Talend Job in Linux. It simply prints "Hello >> /root/test.txt", and the output is not redirected to "/root/test.txt".
The same command when run from Linux redirects output "Hello" to the file test.txt
Is there any other way to write such a command? Can somebody help regarding this.
Thanks and Regards,
Diwakar
Labels (2)
5 Replies
Anonymous
Not applicable
Author

hi,
did you try to create a script with your string as parameter.
Anonymous
Not applicable
Author

hi,
did you try to create a script with your string as parameter.

Hi,
Thanks, That would work, but i don't want to use scripts.
Is that a bug in Talend, or is there any other way to achieve this using tSystem only?

Regards,
Diwakar
Anonymous
Not applicable
Author

The tSystem currently implements the Runtime.Exec(String command), and not Runtime.exec(String[] cmdarray) which would pass a stack of commands. Also, using redirects such as >> or > is fun stuff handled by bash itself. You could try modifying the component to implement the cmdarray or, my preferred method is to use java.io.BuffererReader and BufferedWriter to read and write to an interactive shell session since there are many subtle behaviors that are implmented by the shell itself that will not work through direct system calls as expected.
Anonymous
Not applicable
Author

hi,
I am writing a command:  mysqldump -h "+context.host+"-u "+context.root+"-p"+context.host+"  "+context.database+"> "+context.out_path_name+"
in tsystem for linux through talend this command run but not creating dumpfile & not show any error.
while The same command when run from Linux mysqldump -h localhost -u root -proot  bennet_bi > d:bennet_bi.sql
its creat dump file.
Regards
Ravindra
Anonymous
Not applicable
Author

hi,
i want to create job in which we give database name from csv file & job create mysql dump backup  for all given dataabse.
how can i do it,
thanks
ravindra