1848683 Members
7189 Online
104035 Solutions
New Discussion

autoexpect

 
SOLVED
Go to solution
Donald C Nelson
Frequent Advisor

autoexpect

Does someone know anything about autoexpect. My problem is when my autoexpect script ssh to another client, it just sits at the client's prompt and does not execute the next commands in the script. Is there some thing that I have to do force the script keep on going?
13 REPLIES 13
Sandman!
Honored Contributor
Solution

Re: autoexpect

Could you post your script assuming the ssh connection is configured properly.
Steven E. Protter
Exalted Contributor

Re: autoexpect

Most likely ssh is not configured correctly for password free ssh/scp/sftp.

A few ideas there:

http://www.hpuxconsulting.com/5003.ppt
or
http://www.hpuxconsulting.com/5004.ppt

I can't access them to know which one is the one you may need due to a slow connection here. They're both good though :-)

A never presented HP world powerpoint doc that goes through the whole process.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
TwoProc
Honored Contributor

Re: autoexpect

Good presentations Steven,
I appreciate your sharing the resources.
We are the people our parents warned us about --Jimmy Buffett
Donald C Nelson
Frequent Advisor

Re: autoexpect

Steven, thanks for the power point slides. They are excellent.
Donald C Nelson
Frequent Advisor

Re: autoexpect

Sandman, I am using autoexpect to create the excutable, but when the executable is created, the script stops at the command prompt after logging into the other server. It does not execute any commands after that even though the commands were executed in the autoexpect script.
Donald C Nelson
Frequent Advisor

Re: autoexpect

Here is a copy of the script file that was created by autoexpect.

set timeout -1
spawn ssh dnmst0n
match_max 100000
expect -exact "Last successful login for root: Wed Oct 26 10:40:05 2005 on ttyp4\r\r
Last unsuccessful login for root: Wed Oct 26 09:17:47 2005 on ttyp1\r\r
\r\r
SCO OpenServer(TM) Release 6.0.0\r\r
\r\r
(C) Copyright 1976-2005 The SCO Group, Inc. and its suppliers\r\r
All rights reserved.\r\r
\r\r
For complete copyright credits,\r\r
enter \"copyrights\" at the command prompt.\r\r
\r\r
Good Morning - Welcome to dnmst0n\r
\r
^[GD Good Morning - Welcome to dnmst0n\r
^[GE Good Morning - Welcome to dnmst0n\r
\r
^[\[H^[\[Jdnmst0n#"
send -- "cd /u/Informix\r"
expect -exact "cd /u/Informix\r
cd /u/informix? "
send -- "\r"
expect -exact "\r
ok\r
dnmst0n#"
send -- "pwd\r"
expect -exact "pwd\r
/u/informix\r
dnmst0n#"
send -- "exit\r"
expect eof
Sandman!
Honored Contributor

Re: autoexpect

Donald,

Simplify your "expect/send" interactions by removing the "-exact" switch from the expect command and wildcarding the matches. Could you attach your autoexpect generated script instead of copying and pasting it.

regards!
Donald C Nelson
Frequent Advisor

Re: autoexpect

Sandman, here it is.
Sandman!
Honored Contributor

Re: autoexpect

IMHO...made minor changes to your program. Run it and see if it works?

regards!
Donald C Nelson
Frequent Advisor

Re: autoexpect

Sandman, tell me what you did because it worked correctly.
Sandman!
Honored Contributor

Re: autoexpect

Donald,

Took out the invisible character which appeared in one "send" statement and replaced each of the "expect" statements in your script with:

expect "dnmst0n#"

I'm glad it worked for you!!!
Donald C Nelson
Frequent Advisor

Re: autoexpect

Sandman, I am sorry to bother you again, but can you look at this autoexpect file that I created. I modified just like you had done the previous one, but it will not execute "tbtape -s"
Sandman!
Honored Contributor

Re: autoexpect

see attachment...enjoy!!!