Run an UNIX script on TIC Talend Integration Cloud

Five Stars

Run an UNIX script on TIC Talend Integration Cloud

Hello, I'm trying to run a script .sh in Data Integration Cloud.

I use the tSystem component, and it works perfectly when I run the job on local mode.

However, the script that I run in my tSystem won't work when I run it on the Cloud.

I would like to know if TIC can run an .sh script which contains cUrl commands ?

 

In a second time, I stored temporary files "locally in the Cloud" in paths as:"C:/Talend/out/customer.csv" (which seems to work).

So I would like to know if the path would be the same if I want to refer to this file from my .sh script.

In other words : does an Unix command can use a Windows path?

Thanks


Accepted Solutions
Five Stars

Re: Run an UNIX script on TIC Talend Integration Cloud

I have solved my problem, and here are the results of my research:

  1. In TIC, the current directory is a Talend workspace in a UNIX directory tree. As a simple user (not an admin), the right are limited in directories like "/home/" or "/". My solution was to stay in the current directory, and never call the root directory.
  2. Respecting the previous condition, tSystems work! However I used them by checking "Use Single Command" and by filling Command field by this kind of format "new String[]{"/bin/bash","-c","chmod +x " + context.scriptName}"   (Yes you have first to use chmod before calling a script sh)
  3. Respectiong the previous conditions, cUrl commands work!
  4. For Windows path like "C:/Talend/out/customer.csv", it's stored in the current directory and the whole file name is "C:/Talend/out/customer.csv". 
  5. To answer: "does an Unix command can use a Windows path?" -> Perhaps but put a Windows path look like a Talend Bad Practice

I hope it will help


All Replies
Sixteen Stars

Re: Run an UNIX script on TIC Talend Integration Cloud

I have not tried this on Talend's servers in the cloud and would doubt it would work. Imagine the havoc that someone could cause running scripts like this on Talend's servers. However you can make use of the Remote Engine and do it that way. You are still orchestrating your code in the Cloud but you are running on an engine you own.

Five Stars

Re: Run an UNIX script on TIC Talend Integration Cloud

I have solved my problem, and here are the results of my research:

  1. In TIC, the current directory is a Talend workspace in a UNIX directory tree. As a simple user (not an admin), the right are limited in directories like "/home/" or "/". My solution was to stay in the current directory, and never call the root directory.
  2. Respecting the previous condition, tSystems work! However I used them by checking "Use Single Command" and by filling Command field by this kind of format "new String[]{"/bin/bash","-c","chmod +x " + context.scriptName}"   (Yes you have first to use chmod before calling a script sh)
  3. Respectiong the previous conditions, cUrl commands work!
  4. For Windows path like "C:/Talend/out/customer.csv", it's stored in the current directory and the whole file name is "C:/Talend/out/customer.csv". 
  5. To answer: "does an Unix command can use a Windows path?" -> Perhaps but put a Windows path look like a Talend Bad Practice

I hope it will help

Sixteen Stars

Re: Run an UNIX script on TIC Talend Integration Cloud

Interesting to learn this. I've only ever tried doing stuff like this on a Remote Engine where I have control.