private void BeginService() { _client = new SshClient(Host, UserName, Password); _client.Connect(); _client.RunCommand("sudo pkill mono"); var call = string.Format("cd {0}", _homePiBuildindicatronServer); const string commandText = "sudo mono BuildIndicatron.Server.exe"; var text = call + " && " + commandText; _log.Info("Starting command:" + text); _runCommand = _client.CreateCommand(text); _beginExecute = _runCommand.BeginExecute(); streamReader = new StreamReader(_runCommand.OutputStream); WaitFor("Running", 6000).Wait(); }
/// <summary> /// Begins an asynchronous command execution. /// </summary> /// <returns> /// An <see cref="System.IAsyncResult" /> that represents the asynchronous command execution, which could still be pending. /// </returns> public IAsyncResult BeginExecute() { return(_sshCommand.BeginExecute()); }