Sponsored Content
Full Discussion: Issues with Expect Script
Top Forums Shell Programming and Scripting Issues with Expect Script Post 302994534 by premseth on Friday 24th of March 2017 08:06:08 AM
Old 03-24-2017
Thanks for the response.
But the challenge is i get timeout when i try to put the install out of while.
after the license prompt is the actual install starts.and thats where i could find the best break.
Hence now the installation steps tries to match with last expect and it timeouts.
Code:
...
while {1)
{
       expect 
        -exact "no space" {exit 1}
        -exact "not latest" {exit 1}
       - expect -re {-{10}\r\nlicense-+\(y\/n\) {send "Y\r"" ; break }
}
###LOTS OF ACTIONS takes here 4hrs ####
-exact "\r\n\r\nfolder path2 : "
send "$DIR2\r"

Code:
expect: does "----------------------------------------\\r\n----------------
------------------------\r\nBeginning installing of data packs.\r\n\r\nUnzipping FILE1 and installing\r\n+\r\nUnzipping FILE2 and installing\r\n++++\r\nUnzipping FILE3 and installing\r\n++" (spawn_id exp5) match exact string "\r\n\r\nfolder path2:"? no
expect: timed out
send: sending "/XX/XX/XXXX\r"

I can try adding timeout expect- but how to proceed with the install?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

strange expect script behavior, or am i misunderstanding expect scripting?

Hello to all...this is my first post (so please go easy). :) I feel pretty solid at expect scripting, but I'm running into an issue that I'm not able to wrap my head around. I wrote a script that is a little advanced for logging into a remote Linux machine and changing text in a file using sed.... (2 Replies)
Discussion started by: v1k0d3n
2 Replies

2. Shell Programming and Scripting

Issues with Expect

Here is a snippet of code that work for me: expect "abc" {send_log "abc found" } \ "def" {send_log "def found" } \ "123" {send_log "123 found} however the following does not and according to the book "Exploring Expect" it should be equivalent: expect { "abc"... (1 Reply)
Discussion started by: twk
1 Replies

3. Shell Programming and Scripting

Need help with Expect script for Cisco IPS Sensors, Expect sleep and quoting

This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Discussion started by: genewolfe
1 Replies

4. Shell Programming and Scripting

Expect issues

Hi all, I'm new with expect. I'm developing a quick script to check my sudo access on 100 servers. So using !/bin/usr/expect doesn't work. So decided to use it as : expect -c "set timeout -1;\ spawn ssh $IPADDR -l $USERID ;\ match_max 100000;\ expect { -re... (0 Replies)
Discussion started by: EmersonOrci
0 Replies

5. Shell Programming and Scripting

Expect script help needed- script failing if router unavailable

Hey all. Sometimes I'm tasked to change some router configs for the entire network (over 3,000 Cisco routers). Most of the time its a global config parameter so its done with a loop and an IP list as its the same configuration change for all routers. This is working OK. However, sometimes an... (3 Replies)
Discussion started by: mrkz1974
3 Replies

6. Programming

Calling expect script inside another expect

Hi, Am very new to expect scripting.. Can You please suggest me how to call an expect script inside another expect script.. I tried with spawn /usr/bin/ksh send "expect main.exp\r" expect $root_prompt and spawn /usr/bin/ksh send "main.exp\r" expect $root_prompt Both... (1 Reply)
Discussion started by: Priya Amaresh
1 Replies

7. UNIX for Advanced & Expert Users

Unable to run the script on remote machine Using Expect script

Not able to execute the file in remote host using except utility I am automating the SFTP keys setp process: So i created the expect script for controlling the output of shell below is my main code: Code: #!/usr/bin/expect set fd set password close $fd set df set app close $df... (1 Reply)
Discussion started by: Manoj Bajpai
1 Replies

8. Programming

Calling another expect script inside an expect script

I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues: set REMOTE "/root/scripts/remote" ... log_user 1 send_user "Executing remote script as $user...\n" send_user "Command to execute is: $REMOTE... (1 Reply)
Discussion started by: brettski
1 Replies

9. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

10. Programming

Expect script returning string following a found expect.

I'm fairly new to scripting so this might not be possible. I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue "show version" on a Nexus switch, I'm looking to capture the current firmware version: #show version ... (0 Replies)
Discussion started by: IBGaryA
0 Replies
ppp.Dialers(4)						     Kernel Interfaces Manual						    ppp.Dialers(4)

NAME
ppp.Dialers - PPP dialer description file format DESCRIPTION
The file describes how to dial each type of modem attached to the UNIX system that is to be made available for outbound PPP calls. exam- ines it when placing a call to a neighboring machine. When selects a line from it uses the field to select an entry in from which it uses the field to select an entry in then interprets the field from that dialer description. Format Entries are one to a line; blank lines are ignored. Comments begin with a and extend to the end of the line. Upper/lower case distinc- tions in the dialer field are significant for matching purposes, as are strings in the chat script. Fields on a line are separated by hor- izontal white space (blanks or tabs). If a chat script ends with a backslash the next line is considered a continuation of the chat script. Continuations may only occur in the midst of a chat script. Each entry must contain these fields, in this order: dialer The name of this dialer, to be matched against the dialer field in chat-script A description of the conversation that holds with the modem. Chat Script Particulars A chat script takes the form of a space-separated list of expect-send pairs. Each pair consists (at minimum) of a field to expect the end to send, then a field to send in response. Unless a string ends with will follow it by sending a carriage return character (ASCII 0x0d). Chat scripts are or where the following the hyphen is executed if the preceding fails to match received text. Certain special words may be used in the chat script to control the behavior of as it attempts to dial. Both ABORT and TIMEOUT must be in the phase of the chat script. If sees abort-string while executing the remainder of the chat script, abort the dialing attempt and note the failure in the log file. While executing the current chat script, wait timeout-time seconds for a response before considering the dialing attempt to have timed out. Writes have a fixed 60-second timeout. The expect-send couplet of 'sets the line parity accordingly: Set transmission parity based on the parity observed in characters received in strings. This is the default. Transmit characters with the parity bit set to zero (8 bits, no parity). Transmit characters with the parity bit set to one. Transmit characters with even parity. Transmit characters with odd parity. In the midst of either an string or a string, gets translated into the appropriate control character, and gets translated into x. Other special sequences are: Send or receive a space character (ASCII 0x20). Send or receive a horizontal tab character (ASCII 0x09). Send or receive a line feed character (ASCII 0x0a). Send or receive a carriage return character (ASCII 0x0d). Send or receive a backslash character (ASCII 0x5c). Send or receive a carat character (ASCII 0x5e). Send or receive the single character Ctrl-character (ASCII 0x00 through 0x1f). Send or receive a character, specified in octal digits. Pause for .25 second before proceeding (send only). Delay for two seconds before proceeding (send only). Send a break (.25 second of zero bits). Disable hangups (sets CLOCAL or LNOHANG). enable hangups (unsets CLOCAL or LNOHANG) (the default). Don't append a carriage return character after sending the preceding string (send only). Don't print succeeding send strings (e.g., a password) in any debugging or logging output. Subsequent sequences toggle mode. Insert the telephone number (found in the fifth field of here. EXAMPLES
# # Dialers - PPP dialers file # #Dialer Chat script T1600 ABORT NOsCARRIER ABORT NOsDIALTONE ABORT BUSY ABORT RRING RRING RRING ABORT ERROR TIMEOUT 5 "" AT OK-AT-OK ATS111=0DTT TIMEOUT 30 CONNECT # T2500-PEP ABORT NOsCARRIER ABORT NOsDIALTONE ABORT BUSY ABORT RRING RRING RRING ABORT ERROR TIMEOUT 5 "" AT OK-AT-OK ATS111=0DTT TIMEOUT 30 CONNECTsFAST # USRv32bis ABORT ERROR ABORT NOsANSWER ABORT NOsCARRIER ABORT BUSY ABORT RRING RRING RRING ABORT NOsDIALsTONE TIMEOUT 5 "" AT&F OK-ATQ0-OK ATB0E0X7&B1&H1&I0&K3&R2&S1 OK-AT-OK ATS01=1S02=255S19=0 OK-AT-OK ATDTT TIMEOUT 30 CONNECT AUTHOR
was developed by the Progressive Systems. SEE ALSO
pppd(1), ppp.Auth(4), ppp.Devices(4), ppp.Filter(4), ppp.Keys(4), ppp.Systems(4). RFC 1055. RFC 1144, RFC 1332, RFC 1548, ppp.Dialers(4)
All times are GMT -4. The time now is 11:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy