Re: SSH Message processing - WeOnlyDo Discussion board

Re: SSH Message processing (General questions)

by garyjones, Monday, February 18, 2008, 22:43 (6122 days ago) @ wodDamir

I am using the Execute method and it is in blocking mode. We're generating most code dynamically, but I tried my best to put together a sample of what we're doing below.

Connect method
---------------------
this.Session = new WeOnlyDo.Client.SSH();
this.Session.LicenseKey = xxx;

this.Session.Login = this.Login;
this.Session.Password = this.Password;
this.Session.Timeout = this.TimeOut;
this.Session.Protocol = WeOnlyDo.Client.SSH.SupportedProtocols.SSHAuto;
this.Session.Port = this.Port;
this.Session.Blocking = true;
this.Session.Prompt = this.Prompt;
this.Session.Connect(this.Host);
...
ShellSessionAction parentAction = this.Parent as ShellSessionAction;

if (parentAction == null)
throw new ApplicationException( ShellCommandAction parent is not ShellSessionAction. );

SSH session = parentAction.Session;

// Is Session connected
if (session.State != WeOnlyDo.Client.SSH.States.Connected)
throw new SystemException( Session is not connected. );

ExecuteCommand(session, usr/local/bin/pbrun su-billapp ,this.prompt);
ExecuteCommand(session, cd /opt/apps/billing/${BillingEnv}/billing-batch/scripts/ ,this.prompt);
ExecuteCommand(session, . ./export_env_variables.sh
,this.prompt); //this line has the problem
ExecuteCommand(session, ksh ./delete_emp.sh 123456789
,this.prompt); //this line has the problem
...

Execute method (non important code left out)
-----------------------------
public string ExecuteCommand(WeOnlyDo.Client.SSH session, string commandText, string prompt)
{

string ret = string.Empty;

ret = session.Execute(commandText, this.Prompt, this.Timeout);
return ret
}


Thanks!


Complete thread: