Dennis
Dennis

Reputation: 11

SharpSSH .. how to determine if a process is finished

Im using SHARPSSH SshShell, i was able to connect to my unix box .. i was able to issue my commands (although having a problem verifying the result)

I was able to issue a TAR command , my problem is determinining if the tar is finished.. is there a way to check this using the SHARPSSH ???

any help would be appreciated..

Upvotes: 0

Views: 821

Answers (2)

nut
nut

Reputation: 26

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

Upvotes: 0

Benjamin Podszun
Benjamin Podszun

Reputation: 9827

You didn't show code, so it's hard to judge where the problem might be.

I suggest looking at the official sharpssh samples, specifically this [1] one. It seems to do exactly what you want: Connect, issue commands and waiting for the results/for the termination of these commands.

If that doesn't help, please provide more information.

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

Upvotes: 1

Related Questions