Overview
The tSystem is sometimes an overlooked component in Talend, and rarely used. So in this blog post, we are going to look at how we can inject external application functionality into Talend, such as PuTTY, by using the tSystem component.
Main
As you may know the tSystem component is used to access the command prompt (cmd) on Windows or to use the terminal window on Linux. Therefore, this component inherits functions associated with the respected applications. But this is not the only functionality of the tSystem component. Since you get access to these applications and all of their commands if another application can be triggered from cmd or terminal (for the latter, almost all applications have terminal functionality – it’s Linux after all), then you can run those applications from within Talend.
So we are going to use PSCP application, part of the Full PuTTY installation, and run it from within Talend.
To clarify:
- PuTTY is an SSH and telnet client;
- PSCP, the PuTTY Secure Copy client, is a tool for transferring files securely between computers using an SSH connection;
The Job
As seen from the image above, the job can consist of just one component with a single line of code. The code above has been slightly altered from its original state to include context values where they are required.
Upload Example:
<PSCP File Path> -P <Port number> -l <User Name> -pw <Password> <Host Name or IP Address>:<Source File Path> <Destination Directory>
Parameters explained:
- -p : Port number (can be removed if the port is DEFAULT = 22);
- -l : Login user name;
- -pw : Login user name password (can be removed if no password required during login);
So with a single component and one line of code we can now securely move data from the source destination (Windows) to a Linux machine. We can also perform the opposite and download data from a Linux machine back to the Windows machine. To do that you would need to slightly alter the code and an example of this can be seen below.
Download Example:
<PSCP File Path> -P <Port number> -l <User Name> -pw <Password> Source File Path> <Host Name or IP Address>:<<Destination Directory>
Conclusion
Obviously you could use the Talend tSCP* components to achieve exactly the same result, but the purpose was not to show how to move data from point A to point B, but to demonstrate that you can use other application functionality missing from Talend to make the tool even more powerful. Besides that, I would suggest experimenting with the cmd and in particular, the terminal commands.
For example, you are pulling large files from a remote machine to your Linux machine and the Talend interface cannot tell you how much information has been pulled across; what is the current disk space of the files that are being downloaded? With a tSystem component and a terminal or PowerShell watch command you can look into a folder with a predefined refresh rate and send back the results to the console log. Thus informing you of the current progress from a new perspective. Something that cannot be achieved through job statistics. And that is just one example of the additional functionality you can embed into Talend with this powerful yet overlooked component.
How to execute .bat file situated in remote server using tSystem in Talend from our local system . I have installed Kpym Telnet ssh server on my remote server. When I execute .bat file using Putty i will get results .
But when I use tSystem it will not give me the results using same command and credentials which are working with Putty.
Reply pls…!