夏普 .如何确定流程是否已完成
本文关键字:是否 已完成 程是否 何确定 夏普 | 更新日期: 2023-09-27 17:56:24
我使用SHARPSSH SshShell,我能够连接到我的unix盒子..我能够发出我的命令(尽管在验证结果时遇到问题)
我能够发出TAR命令,我的问题是确定tar是否完成..有没有办法使用SHARPSSH ???检查这一点
任何帮助将不胜感激。
您没有显示代码,因此很难判断问题可能出在哪里。
我建议查看官方的sharpssh样本,特别是这个[1]样本。它似乎完全符合您的要求:连接,发出命令并等待结果/终止这些命令。
如果这没有帮助,请提供更多信息。
1: http://sharpssh.svn.sourceforge.net/viewvc/sharpssh/trunk/Examples/sharpssh_samples/SshExeTest.cs?revision=3&view=markup
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