How to Execute Shell script in Informatica BDM using command task. Most of the file operations and other functionalities can be done through a shell script quickly and informatica is providing an option to execute the shell script using a command task. Let’s see how to do that by taking an example.
I have a scenario to display the content of a log file in an email. There are many options to do this, but Let’s do this using a command task & notification task. Lets assume the log file is generated and available in informatica server location.
Command Task – Will execute a shell command to read the content of the file to a workflow variable.
In the command property, you can directly give the shell commands, You can also call a script file (.sh) to do the same. The below CAT command read & assign the content to the workflow variable. Assign the other variable v_log_content in the Output Standard out to get the script output, In our scenario, the data from the log file.
In the notification task, Parse the body like below to display the log file content within the email.
That’s all, Deploy the workflow to an application and run it, You will receive an email with the content of the file as you see below.
With this exercise, we have learnt,
- How to configure a command task to execute a shell command
- How to get the shell command output to a variable
- How to parse the workflow variable to an email notification task
Have any questions? or need help with this topic, please do reach out to me at kvtinformatica@gmail.com. Don’t forget to follow my Youtube channel and FB page, Lets stay connected and learn together.