2011-05-13 21 views
0

進出口使用SHARPSSH SshShell,我是能夠連接到我的UNIX箱..我能發出我的命令(雖然有檢驗結果的問題)SharpSSH ..如何確定一個過程完成

我能夠發出一個TAR命令,我的問題是確定是否tar完成..有沒有辦法使用SHARPSSH檢查這個?

任何幫助,將不勝感激..

回答

1

你沒有顯示的代碼,所以很難判斷哪裏出了問題可能是。

我建議看官方sharpssh樣本,特別是這[1]一。它似乎正是你想要的:連接,發出命令等待結果/終止這些命令。

如果沒有幫助,請提供更多信息。

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

+0

sshell.WriteLine( 「EXP系統/ my4v4t4r#文件= PGNIGDV_budjo.DMP日誌= PGNIGDV_budjo.log充分= Y STATISTICS = NONE」); -----如何確定「EXP」命令是否完成? ---- – Dennis

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