From: praveen m. <mal...@gm...> - 2007-11-21 01:44:06
|
Hi Guys, I have problem with executing the remote command , like mkdir , chmod etc... . If they are executed successfully they doesn't return anything. I need someway to verify that they got executed successfully. Is there any idea? Second problem I have is that I am executing the remote command , first I make the ssh connection then I send the command one by one. Problem is that when will I get to particular command is get finished. because I guess slave system is not returning the EOF as that is closing the stdout may be stdin also. I did something like that... $exp->("commad;echo command finished"); and I expect the "command finished". $exp->expect("600","command finished"); Here I am hardcoding the 600 seconds to wait for that. If any script/command takes more than 600 seconds then obiviously it will fail. I want to wait for forever until I get the "command finished". Please don't tell me to do the $exp->expect(undef) because I am not able to receive the EOF from slave system. I do not want to put any time limitation like 600 seconds. I want it should wait for forever for "command finished" not for EOF. I read all the tutorial what I get is: ou are probably on one of the systems where the master doesn't get an EOF when the slave closes stdin/out/err. One possible solution is when you spawn a process, follow it with a unique string that would indicate the process is finished. $process = Expect->spawn('telnet somehost; echo ____END____'); And then $process->expect($timeout,'____END____','other','patterns'); I did not get this line what the 'other' and 'pattern' mean over here. If anyone is able to solve this problem really that will be better for me. Thanks, Praveen Mall |