SHARPSSH SshShellを使用しているので、UNIXボックスに接続できました。コマンドを発行できました(結果の検証に問題があります)。
TARコマンドを発行できましたが、tarが終了したかどうかを判断するのに問題があります。SHARPSSHを使用してこれを確認する方法はありますか?
どんな助けもいただければ幸いです。
コードを示していないため、どこに問題があるのかを判断するのは困難です。
公式の Sharpssh サンプル、特にこの [1] を参照することをお勧めします。まさにあなたが望むことをしているようです:接続し、コマンドを発行し、結果を待っている/これらのコマンドの終了を待っています。
それでも解決しない場合は、さらに情報を提供してください。
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