This project is read-only.

Command not working in API

Jul 26, 2013 at 6:17 PM
Edited Jul 26, 2013 at 6:18 PM
Hello,

I readed that the ssh API create always a new session for a Command, so I executed my command like this:

command1; command2
string command = "ulimit; Parameters[2].ToString";
var cmd = ssh.CreateCommand(command);
cmd.Execute();
So, he execute ulimit and other function, but it stops like after 2 mins, because of
CPU time limit exceeded
When I self run this in PuttY (ulimit and then my command) it's working fine.
Jul 26, 2013 at 8:46 PM
This is not the code you are using:

string command = "ulimit; Parameters[2].ToString";

cause this is nonsense ;)

Please paste your real code!
Jul 26, 2013 at 8:57 PM
Edited Jul 26, 2013 at 9:00 PM
ulimit is a shell builtin.

http://en.wikipedia.org/wiki/Shell_builtin
http://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html

Try:
string command = "bash -c \"ulimit && Parameters[2].ToString\"";
fixing this string is up to you :P
Jul 26, 2013 at 10:01 PM
Edited Jul 26, 2013 at 10:01 PM
da_rinkes wrote:
This is not the code you are using:

string command = "ulimit; Parameters[2].ToString";

cause this is nonsense ;)

Please paste your real code!
string command = "ulimit; " + Parameters[2].ToString;
thats right :D

No the second doesn't work to, all working fine for 2-3 minutes and then he just stop my script.
When I run it self over PuttY, all working fine.