[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Unable to execute program
[Thread Prev] | [Thread Next]
- Subject: RE: Unable to execute program
- From: h2c357 h2c357 <h2c357@xxxxxxx>
- Reply-to: libssh@xxxxxxxxxx
- Date: Fri, 14 Oct 2011 12:06:40 +0000
- To: <libssh@xxxxxxxxxx>
Thanks Aris, I did what you suggested and it proved what I had thought before. The error complains about shared libraries not being found. So I my .bashrc and .bash_profile files to export the shared library path and it worked like a charm. Thanks a lot. > Date: Fri, 14 Oct 2011 13:00:00 +0200 > From: aris@xxxxxxxxxxxx > To: libssh@xxxxxxxxxx > Subject: Re: Unable to execute program > > Hi, > > Have a look at the output of stderr : ssh_channel_read(..., 1); > > This will give more info about what's happening. > Also, ssh_channel_request_exec is returning immediatly, and does not > return the exit code of the process. For this, you should look at > ssh_channel_exit_status. > > Kr, > > Aris > > Le 14/10/11 12:32, h2c357 h2c357 a écrit : > > Hi all, > > > > I am running sshd on Fedora Core 15 and my ssh client is running on > > Window XP(sorry). I have an executable which requires some .so files to > > run. The whole directory structure becomes something like following: > > > > /home/h2c357/app/bin/my_executable (This is the path my executable) > > > > (my lib directories are stored in following locations) > > /home/h2c357/app/lib/ > > /usr/lib/oracle/11.2/client64/lib > > > > Now when I try to execute my_executable on remote machine via libssh > > client, I do not get any error (channel_request_exec() returns 0) but > > when I try to read program output (it prints some data it reads from the > > db), I get bytes read count 0. Also system monitor on FC15 does not show > > my process. > > > > Please let me know what I might be doing wrong. > > > > Below is the code that I have written: > > > > ssh_channel createChannel(ssh_session session_) > > { > > ssh_channel channel; > > bool isChannelCreated_ = true; > > > > channel = channel_new(session_); > > if (channel == NULL) > > { > > isChannelCreated_ = false; > > return NULL; > > } > > > > if (channel_open_session(channel) != SSH_OK) > > { > > isChannelCreated_ = false; > > channel_free(channel); > > return NULL; > > } > > > > return channel; > > } > > > > void execute(std::string appCmdLine, std::string ldCommand) > > { > > int execStatus_ = 0; > > ssh_channel channel = createChannel(); > > if (!isChannelCreated_ || channel == NULL) > > { > > execStatus_ = EXEC_STATUS_FAILURE; > > return; > > } > > > > int rc = channel_request_exec(channel, > > appCmdLine.c_str()); > > if (rc != SSH_OK) > > { > > execStatus_ = EXEC_STATUS_FAILURE; > > channel_close(channel); > > channel_free(channel); > > } > > else > > { > > execStatus_ = EXEC_STATUS_SUCCESS; > > > > char buffer[256]; > > unsigned int nbytes; > > > > nbytes = channel_read(channel, buffer, > > sizeof(buffer), 0); > > while (nbytes > 0) > > { > > if (fwrite(buffer, 1, nbytes, stdout) != nbytes) > > { > > ssh_channel_close(channel); > > ssh_channel_free(channel); > > return; > > } > > nbytes = ssh_channel_read(channel, buffer, > > sizeof(buffer), 0); > > } > > > > if (nbytes < 0) > > { > > ssh_channel_close(channel); > > ssh_channel_free(channel); > > return; > > } > > channel_send_eof(channel); > > closeChannel(channel); > > } > > } > > >
Unable to execute program | h2c357 h2c357 <h2c357@xxxxxxx> |
Re: Unable to execute program | Aris Adamantiadis <aris@xxxxxxxxxxxx> |