I am relatively new to Talend and have done multiple searches for assistance with this issue but I have not found anything to help me resolve it. I am using the tSystem component to run a unix batch file that contains a mysql call. If I process it from a terminal session the .sh file works properly. When the same file is called by tSystem the following error results: line 1: mysql: command not found Here is a simplified look at the .sh file: mysql -u user --password=password --host=server MyDatabase "select * from mytable where Flag <> 'Y' ;" | sed 's/\t/,/g' > /networkpath/outputfile.csv I think there may be an issue with my command piping the data to SED and then to the output file.
Yes, the reason is if you call it from a e.g. bash you have all your environment settings ready (e.g. the $PATH variable or some MySQL vars). The tSystem is a very simple call without any environment settings in the first place. It depends on the user which runs the job. Actually I would call the mysql client with its full path to avoid the problem with the missing PATH variable.
Thanks for the reply. I made the change and the script now works: /usr/local/mysql/bin/mysql -u user --password=password --host=server MyDatabase "select * from mytable where Flag <> 'Y' ;" | sed 's/\t/,/g' > /networkpath/outputfile.csv
I use tSystem to execute a python script and the python script will call other commands. It is essential to have all the environment settings to the tSystem. How can I set the PATHS on the fly ?
Thanks kzone,
I tried to add source in TOS but it throws Cannot run program "source" error.
I tried to source it in the python script but paths still cannot be used.
Some updates,
To use source, I have to create a .sh file containing
source fileName;
{fullPath}/python fileName.py
and chmod +w the .sh file
Then, i encounter other problems.
Some programs require environment setting such as some files located in $HOME directory.
However, it seems the $HOME directory is different.
I try to use echo $HOME command but it does not work.
I can foresee there will be many more problems if the environment setting is different to my development setting.
Can I have the tShell environment setting exactly the same to the development setting?
Thanks