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
GEMS-SERVER(1)							gems documentation						    GEMS-SERVER(1)

NAME
gems-server - Transmit a shell session in real time. SYNOPSIS
gems-server [-ip ip] [-port p] [-maxconn n] [-wait m] [-log dest] [-noscript] [-script_bin script] gems-server -h | -v DESCRIPTION
Transmits a shell session to be shown in real time in various different computers or terminals. gems-server transmits data in real time to clients via a network connection. Each one of these clients must run the gems-client(1) program to establish connection and receive the transmitted data. Clients can connect and disconnect at any given time, but of course they will only receive the data that is transmitted while they are connected (just like a radio transmission/reception system). The gems system is normally used to transmit a console session and show it in various computers at the same time, but it is also possible to transmit any other kind of data. OPTIONS
-ip IP address where connections will be accepted. -port TCP port. Default: 6666. -maxconn Do not accept more than n simultaneous clients. Default: 25. -wait Wait until m clients are connected before starting the transmission. This is useful to ensure that the first m clients will receive all data transmitted. The default behavior is to start transmission immediately, without waiting for client connections. -log By default, the server does not write log messages. This option configures the destination of logs. The dest argument can be `sys- log' (to log through syslogd(8)), `stderr' (to log through standard error output), or it can be an arbitrary filename (log messages will be appended to the file, if it exists). -noscript By default, the server executes the script(1) program to take terminal data and transmit it. When this option is used the server will not run script, and data will be read form standard input. -script_bin Specifies the location of the script(1). program. Default: /usr/bin/script. -h Show a short help message. -v Show version information. FILES
/var/lock/gems-server.PORT Lock file. gems-server creates this file on initialization and deletes it on exit. PORT is replaced by the TCP port used. gems- server will not run if this file is already present in the system. AUTHORS
Diego Essaya <dessaya@fi.uba.ar> Emiliano Castagnari <ecastag@fi.uba.ar> SEE ALSO
gems-client(1), script(1), syslogd(8) gems AUGUST 2004 GEMS-SERVER(1)