Why don't you just write a shell script that groups the remote commands
and also checks their exit states and then directly call that script
with 'ssh remote-script.sh'? Alternatively you could execute those
commands one by one using only ssh, because ssh will report the exit
status back to you...
$ ssh user@host "exit 78"; echo $?
78
Expect is only for "curing those uncontrollable fits of interaction". as
Don Libes has put it. If you can manage without, do so.
Hope this helps,
Roland
praveen mall wrote:
> 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
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Expectperl-discuss mailing list
> Exp...@li...
> https://lists.sourceforge.net/lists/listinfo/expectperl-discuss
>
|