Reputation: 11
Im using SHARPSSH SshShell, i was able to connect to my unix box .. i was able to issue my commands (although having a problem verifying the result)
I was able to issue a TAR command , my problem is determinining if the tar is finished.. is there a way to check this using the SHARPSSH ???
any help would be appreciated..
Upvotes: 0
Views: 821
Reputation: 26
SshExec exec = new SshExec("host","user");
exec.Password = "pass";
//if (input.IdentityFile != null) exec.AddIdentityFile(input.IdentityFile);
Console.Write("Connecting...");
exec.Connect();
Console.WriteLine("OK");
while (true)
{
Console.Write("Enter a command to execute ['Enter' to cancel]: ");
string command = "ls";
if (command == "") break;
string output = exec.RunCommand(command);
Console.WriteLine(output);
}
Console.Write("Disconnecting...");
exec.Close();
Console.WriteLine("OK");
enter code here
Upvotes: 0
Reputation: 9827
You didn't show code, so it's hard to judge where the problem might be.
I suggest looking at the official sharpssh samples, specifically this [1] one. It seems to do exactly what you want: Connect, issue commands and waiting for the results/for the termination of these commands.
If that doesn't help, please provide more information.
Upvotes: 1