This project is read-only.

problems executing command

Mar 26, 2014 at 1:33 PM
Hi everyone,

I need to create a connection to a linux machine and execute a .42r binary file.

To run this type of files we have an utility call fglrun. My code is ok, but my problem (think so..) is that i can´t load the enviroment settings, to make the fglrun command runs. I think this is my problem, because if i type a native command such as, 'ls' or 'pwd', I get the correct result.

I have a shell in the linux machine, that is the responsable of running my binary file. Code of the shell:
export FGLDIR

/home/genero/241/fgl/bin/fglrun  /home/genero/ssh.42r
echo 123
As you can see, I am trying to load through the fgldir command the fglrun utility. Then i run the .42r file that i want to run and finally 'echo' to see at least, something happends.

To exe my shell i use this .Net Code:
using (var ssh = new SshClient(new PasswordConnectionInfo("MyHost", "User", "Pass")))
                var cmd = ssh.RunCommand("./");
My shell is called

Thank you in advance.
Mar 26, 2014 at 2:43 PM
using (var ssh = new SshClient(new PasswordConnectionInfo("MyHost", "User", "Pass")))
                var cmd = ssh.RunCommand("FGLDIR=\"/home/genero/241/fgl\" /home/genero/241/fgl/bin/fglrun  /home/genero/ssh.42r");
                Console.WriteLine("Result: Stdout: {0} Stderr: {1} ({2})", cmd.Result, cmd.ExitStatus, cmd.Error);
  1. there is no need to have a shell script. Maintaining two sides is overkill IMHO ;)
  2. I suspect the problem was you don't call you shell script with a absoulte path
  3. _Always check your ExitStatus and Error output
If its still not working number 3 can give further hints.
Marked as answer by drieseng on 4/6/2014 at 10:24 AM
Mar 26, 2014 at 4:43 PM
Thank you very much da_rinkes!! you gave me the seed of the solution.

When the error was display, i realise that i have to load all the enviroments variables. Then i create an exe file to load all this varibles (LD_LIBRARY_PATH, Informixserver,database...)

Finally my .Net Code is very similar as yours. The only change was:
var cmd = ssh.RunCommand(" . .bash_profile \n fglrun  /home/genero/ssh.42r");