Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Executing a Linux command using a tSystem component

Helllo,

I need to execute this linux command:

sudo su - hdfs -c "echo -n > /opt/application/bdfalh/test/log/hdfs-audit.log"

 

in tSystem, I used:

"sudo su - hdfs -c \"echo -n > "+context.rep_filesystem_log_hdfs+"hdfs-audit.log\""

 

I tried many different ways, single commen, array command, putting the command into a variable

nothing works so far.


At the execution, Talend returns no error but nothing happens on the server

 

Does anyone have any idea.

 

Thanks

Labels (2)
1 Solution

Accepted Solutions
vapukov
Master II
Master II

as 100% working variant - use .sh file instead of command

 

I remember we also meet with cases when tSystem do not work as expected and start use bash scripts instead, it often adds additional flexibility

View solution in original post

5 Replies
Anonymous
Not applicable
Author

Hi,

 

    Did you check whether the Linux user which Talend is using to execute the command (say talend) is having the authorization to perform sudo su to hdfs user?

 

Warm Regards,
Nikhil Thampi

Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂

vapukov
Master II
Master II

add to @nthampi question (just to check):

 

does context.rep_filesystem_log_hdfs ended with / ?

Anonymous
Not applicable
Author

Hi,

 

@nthampi : absolutly, that user has the right, I add it to sudoers file, plus when I launch the command throw linux terminal in the server, it does work.

@vapukov : yes, context.rep_filesystem_log_hdfs=/opt/hdp/log/hdfs/hdfs/

    Did you check whether the Linux user which Talend is using to execute the command (say talend) is having the authorization to perform sudo su to hdfs user?

 

I wana add that I have two others tSystem (sudo cp and sudo mv), both work fine.
 
Regards
vapukov
Master II
Master II

as 100% working variant - use .sh file instead of command

 

I remember we also meet with cases when tSystem do not work as expected and start use bash scripts instead, it often adds additional flexibility

Anonymous
Not applicable
Author

thanks that works 0683p000009MACn.png