Executing a Linux command using a tSystem component

Three Stars

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

Tags (1)

Accepted Solutions
Forteen Stars

Re: Executing a Linux command using a tSystem component

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

-----------

All Replies
Employee

Re: Executing a Linux command using a tSystem component

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 :-)

Forteen Stars

Re: Executing a Linux command using a tSystem component

add to @nikhilthampi question (just to check):

 

does context.rep_filesystem_log_hdfs ended with / ?

-----------
Three Stars

Re: Executing a Linux command using a tSystem component

Hi,

 

@nikhilthampi : 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
Forteen Stars

Re: Executing a Linux command using a tSystem component

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

-----------
Three Stars

Re: Executing a Linux command using a tSystem component

thanks that works Smiley Happy

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads