0

SHARPSSH SshShellを使用しているので、UNIXボックスに接続できました。コマンドを発行できました(結果の検証に問題があります)。

TARコマンドを発行できましたが、tarが終了したかどうかを判断するのに問題があります。SHARPSSHを使用してこれを確認する方法はありますか?

どんな助けもいただければ幸いです。

4

2 に答える 2

1

コードを示していないため、どこに問題があるのか​​を判断するのは困難です。

公式の Sharpssh サンプル、特にこの [1] を参照することをお勧めします。まさにあなたが望むことをしているようです:接続し、コマンドを発行、結果を待っている/これらのコマンドの終了を待っています。

それでも解決しない場合は、さらに情報を提供してください。

1: http://sharpssh.svn.sourceforge.net/viewvc/sharpssh/trunk/Examples/sharpssh_samples/SshExeTest.cs?revision=3&view=markup

于 2011-05-13T09:46:50.490 に答える
0
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
于 2011-07-20T09:30:01.930 に答える