Help with EXPECT script hanging


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help with EXPECT script hanging
# 1  
Old 03-11-2008
Tools Help with EXPECT script hanging

I am new at developing EXPECT scripts. I'm trying to create a script that will automatically connect to a UNIX server via FTP and download a log file from the server within a specified server directory on the remote machine. I'm having problems with the EXPECT script "hanging" at the password prompt. Any help would be appreciated to get this issue resolved. Below is the code snippet and the actual results that are shown when executing this Expect script within a Bash file. Please take into consideration that I can't provide the exact server name in the code snippet.

Code:

set tgtHostLong [lindex $argv 1]
set ftpUser [lindex $argv 2]
set password [lindex $argv 3]
set timeout -1
spawn ftp $tgtHostLong
match_max 100000
expect -exact "User ($tgtHostLongSmilienone)):"
send -- "$ftpUser\r"
expect -exact "Password: "
send -- "$password\r"
expect -exact "ftp> "

Actual Result:

spawn ftp xxxxxxxx.xxxx.xxx.com
User (xxxxxxxx.xxxx.xxx.comSmilienone)): m25047
Password:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. 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

2. 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

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

Perl Script Hanging

Hey, Does anyone know why my Perl script is hanging when i execute it. print "looking around ...\n"; my ($out, $err, $exit) = $scon->cmd('ls'); print "done"; i get the following error: channel 1: open confirm rwindow 131043 rmax 32768 I'm using use Net::SSH::W32Perl Module.... (4 Replies)
Discussion started by: Phi01
4 Replies

5. Shell Programming and Scripting

script hanging???

ok... this is where i am at... i need a script to call another script as a wrapper because the first script creates a sub-shell. here is what i got... i kick off the first script "CCBDEMO-threadpoolworker.sh" #!/bin/bash clear #clearing screen directory="/data1/spl/cis/CCBDEMO/bin"... (1 Reply)
Discussion started by: Dagaswolf
1 Replies

6. 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

7. Shell Programming and Scripting

Script is hanging

Hello, I have the following shell script and when i execute, it keeps hanging and nothing happens Please let me know. Requirement is to read data from file and pass it to the sql and create files as shown. code /******** #!/bin/sh while read user.dat do echo "user = $1 email =... (1 Reply)
Discussion started by: rakeshsr12
1 Replies

8. Linux

Script to simulate hanging process

I want to create a script to simulate a process that hangs to test a java application. My java app executes a system command, which can also be executing scripts, etc. Any ideas on such a script? The java code is: Runtime rt = Runtime.getRuntime(); Process p = rt.exec("sh... (4 Replies)
Discussion started by: brendan76
4 Replies

9. Shell Programming and Scripting

script hanging - remsh

Greetings to everyone, My Problem: I have a script which inturn calls couple of other scripts in different servers (solaris) to do a server startups on the respecitve boxes. My script ... #!/usr/bin/ksh siebsrvr_root=/users/siebelserver/siebsrvr cd $siebsrvr_root . ./siebenv.sh... (2 Replies)
Discussion started by: vivsiv
2 Replies

10. UNIX for Dummies Questions & Answers

hanging sql script

Need your help pls... I have integrated my shell script with sqlplus statements that will fetch necessary data for the rest of the script. As observed, sometimes problems at the oracle database occurs wherein users can not login via sqlplus, so does the script. During execution, the logging of... (4 Replies)
Discussion started by: inquirer
4 Replies
Login or Register to Ask a Question
VARNISHTEST(1)															    VARNISHTEST(1)

NAME
varnishtest - Test program for Varnish SYNOPSIS
varnishtest [-n iter] [-q] [-v] file [file ...] DESCRIPTION
The varnishtest program is a script driven program used to test the Varnish Cache. The varnishtest program, when started and given one or more script files, can create a number of threads representing backends, some threads representing clients, and a varnishd process. The following options are available: -n iter Run iter number of iterations. -q Be quiet. -v Be verbose. -t Dunno. file File to use as a script SCRIPTS
Example script # Start a varnish instance called "v1" varnish v1 -arg "-b localhost:9080" -start # Create a server thread called "s1" server s1 { # Receive a request rxreq # Send a standard response txresp -hdr "Connection: close" -body "012345 " } # Start the server thread server s1 -start # Create a client thread called "c1" client c1 { # Send a request txreq -url "/" # Wait for a response rxresp # Insist that it be a success expect resp.status == 200 } # Run the client client c1 -run # Wait for the server to die server s1 -wait # (Forcefully) Stop the varnish instance. varnish v1 -stop Example script output The output, running this script looks as follows. The "bargraph" at the beginning of the line is an indication of the level of detail in the line. The second field where the message comes from. The rest of the line is anyones guess :-) # TEST tests/b00000.vtc starting ### v1 CMD: cd ../varnishd && ./varnishd -d -d -n v1 -a :9081 -T :9001 -b localhost:9080 ### v1 opening CLI connection #### v1 debug| NB: Storage size limited to 2GB on 32 bit architecture, #### v1 debug| NB: otherwise we could run out of address space. #### v1 debug| storage_file: filename: ./varnish.Shkoq5 (unlinked) size 2047 MB. ### v1 CLI connection fd = 3 #### v1 CLI TX| start #### v1 debug| Using old SHMFILE #### v1 debug| Notice: locking SHMFILE in core failed: Operation not permitted #### v1 debug| bind(): Address already in use #### v1 debug| rolling(1)... #### v1 debug| #### v1 debug| rolling(2)... #### v1 debug| Debugging mode, enter "start" to start child ### v1 CLI 200 <start> ## s1 Starting server ### s1 listen on :9080 (fd 6) ## c1 Starting client ## c1 Waiting for client ## s1 started on :9080 ## c1 started ### c1 connect to :9081 ### c1 connected to :9081 fd is 8 #### c1 | GET / HTTP/1.1 #### c1 | ### c1 rxresp #### s1 Accepted socket 7 ### s1 rxreq #### s1 | GET / HTTP/1.1 #### s1 | X-Varnish: 422080121 #### s1 | X-Forwarded-For: 127.0.0.1 #### s1 | Host: localhost #### s1 | #### s1 http[ 0] | GET #### s1 http[ 1] | / #### s1 http[ 2] | HTTP/1.1 #### s1 http[ 3] | X-Varnish: 422080121 #### s1 http[ 4] | X-Forwarded-For: 127.0.0.1 #### s1 http[ 5] | Host: localhost #### s1 | HTTP/1.1 200 Ok #### s1 | Connection: close #### s1 | #### s1 | 012345 #### s1 | ## s1 ending #### c1 | HTTP/1.1 200 Ok #### c1 | Content-Length: 9 #### c1 | Date: Mon, 16 Jun 2008 22:16:55 GMT #### c1 | X-Varnish: 422080121 #### c1 | Age: 0 #### c1 | Via: 1.1 varnish #### c1 | Connection: keep-alive #### c1 | #### c1 http[ 0] | HTTP/1.1 #### c1 http[ 1] | 200 #### c1 http[ 2] | Ok #### c1 http[ 3] | Content-Length: 9 #### c1 http[ 4] | Date: Mon, 16 Jun 2008 22:16:55 GMT #### c1 http[ 5] | X-Varnish: 422080121 #### c1 http[ 6] | Age: 0 #### c1 http[ 7] | Via: 1.1 varnish #### c1 http[ 8] | Connection: keep-alive #### c1 EXPECT resp.status (200) == 200 (200) match ## c1 ending ## s1 Waiting for server #### v1 CLI TX| stop ### v1 CLI 200 <stop> # TEST tests/b00000.vtc completed If instead of 200 we had expected 201 with the line:: expect resp.status == 201 The output would have ended with:: #### c1 http[ 0] | HTTP/1.1 #### c1 http[ 1] | 200 #### c1 http[ 2] | Ok #### c1 http[ 3] | Content-Length: 9 #### c1 http[ 4] | Date: Mon, 16 Jun 2008 22:26:35 GMT #### c1 http[ 5] | X-Varnish: 648043653 648043652 #### c1 http[ 6] | Age: 6 #### c1 http[ 7] | Via: 1.1 varnish #### c1 http[ 8] | Connection: keep-alive ---- c1 EXPECT resp.status (200) == 201 (201) failed SEE ALSO
o varnishhist(1) o varnishlog(1) o varnishncsa(1) o varnishstat(1) o varnishtop(1) o vcl(7) HISTORY
The varnishtest program was developed by Poul-Henning Kamp <phk@phk.freebsd.dk> in cooperation with Varnish Software AS. This manual page was written by Stig Sandbeck Mathisen <ssm@linpro.no> using examples by Poul-Henning Kamp <phk@phk.freebsd.dk>. COPYRIGHT
This document is licensed under the same licence as Varnish itself. See LICENCE for details. o Copyright (c) 2007-2008 Varnish Software AS AUTHOR
Stig Sandbeck Mathisen 1.0 2010-05-31 VARNISHTEST(1)