Sponsored Content
Top Forums Shell Programming and Scripting Expect script error : send: spawn id exp4 not open Post 302973397 by Corona688 on Tuesday 17th of May 2016 11:16:11 AM
Old 05-17-2016
We are not "on call". If someone doesn't answer your question immediately, and you have no further information to provide, wait! I didn't get here just because you bumped it.

"spawn id exp4 not open" is the message expect gives when the thing you're communicating with, telnet in this case, dies while you're trying to use it. Try telneting to that IP / port manually and see what it does.

Your shell script can probably be made far more efficient -- you don't need the help of head, tail, and cut to read and tokenize lines from a file one by one, there's a command just for that.

Code:
while read ip port
do
        echo "$ip $port"
done < /tmp/DSlist

This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Expect: Beginner help with spawn and expect

Hello hello, did a quick search and didn't turn up anything helpful. I've got a book I'm sure has the answers, but I don't think I'll have time to finish it before this all has to work, so here goes~ if this isn't a good place to post and someone could direct me to another forum I'd appreciate... (1 Reply)
Discussion started by: Vryali
1 Replies

2. Shell Programming and Scripting

Expect: How to read buffer for spawn

Hi All, I have to write one expect script to login to one system. I am using set timeout -1 match_max 100000 spawn ssh root@hostname Now when I do spawn ssh to that host it send some warning message and one challenge Challenge: 111-2345 I need to read this challenge value and has... (1 Reply)
Discussion started by: Lokesh Agrawal
1 Replies

3. AIX

send: spawn id exp3 not open

Hi, AIX 5.3 Trying to implement script that change oracle password. Getting following errors: send: spawn id exp3 not open while executing "send "xxx\r" Any idea? (4 Replies)
Discussion started by: groosha
4 Replies

4. Shell Programming and Scripting

Expect Script Error invalid spawn id (6)

Hi everybody, We are trying to connect to a server and to a router using an .expect script that automatically authenticate the username and password needed. The error is that we cannot connect to the server using ssh AND we cannot connect to the router using either telnet or go commands from the... (1 Reply)
Discussion started by: omoyne
1 Replies

5. Shell Programming and Scripting

Can 'spawn' command be used more than once in an expect script ?

Can 'spawn' script be used more than once in a given expect script ?? What I'm trying to do is, first log-into a remote server through one 'ssh' spawn com and then from there log-into another server using a secod 'ssh' spawn command. But this approach is not working... the second ssh attempt... (1 Reply)
Discussion started by: clakkad
1 Replies

6. Shell Programming and Scripting

Using expect command, spawn will not start sftp process

Hi all, I have a script that runs sftp with expect so I can login and send a file in a cronjob. I've installed this on a couple other servers and it has been fine. However, this time on this machine, it seems to be giving me an issue. It won't move past the spawn sftp command and return a... (3 Replies)
Discussion started by: ltyrrell
3 Replies

7. Shell Programming and Scripting

Using spawn and expect getting error

#!/bin/sh # # set -x stty -echo; read -p "Input password:" A; stty echo; echo; for HOST in `cat elc.hosts.list` do # echo "Connecting to $HOST" expect -c "set timeout -1;\ spawn sshr $HOST -l root \"mkdir /perfstat;\";\ match_max 100000;\ expect *'/root/.ssh/id_dsa':*;\ send --... (1 Reply)
Discussion started by: madlot
1 Replies

8. Shell Programming and Scripting

Error in spawn and expect for password

Code Broken!! "cod generator ip=$loja" expect -c " # set timeout -1 set timeout 18 spawn scp -C /etc/samba/arkivo.sh root@$loja:/etc/samba/ expect { -re "*yes/no*"{ send "yes\r" exp_continue } -re "*password:*" { send "senha\r" expect \"*#*\"}} ssh root@$loja expect \"*password:*\"... (4 Replies)
Discussion started by: hrenechen
4 Replies

9. Shell Programming and Scripting

Expect: spawn id exp5 not open while executing "expect "$" { send "sudo su -\r" }"

Hi All, i am trying to ssh to a remote machine and execute certain command to remote machine through script. i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as expect: spawn id exp5 not open while executing "expect "$" {... (3 Replies)
Discussion started by: Siddharth shivh
3 Replies

10. Shell Programming and Scripting

Couldn't read packet: Connection reset by peer send: spawn id exp4 not open while executing

Hi All, I am having an issue with my script which I am using to get files from a remote server. In my script I am going to server:- REMOTESERVER and directory:- /Interface/Upload, and then getting files from there to my local server directory:- /ftp/jail_nextview_LMS/home/nextview_LMS/outbox. ... (1 Reply)
Discussion started by: Hero6438
1 Replies
Test::Expect(3pm)					User Contributed Perl Documentation					 Test::Expect(3pm)

NAME
Test::Expect - Automated driving and testing of terminal-based programs SYNOPSIS
# in a t/*.t file: use Test::Expect; use Test::More tests => 13; expect_run( command => "perl testme.pl", prompt => 'testme: ', quit => 'quit', ); expect("ping", "pong", "expect"); expect_send("ping", "expect_send"); expect_is("* Hi there, to testme", "expect_is"); expect_like(qr/Hi there, to testme/, "expect_like"); DESCRIPTION
Test::Expect is a module for automated driving and testing of terminal-based programs. It is handy for testing interactive programs which have a prompt, and is based on the same concepts as the Tcl Expect tool. As in Expect::Simple, the Expect object is made available for tweaking. Test::Expect is intended for use in a test script. SUBROUTINES
expect_run The expect_run subroutine sets up Test::Expect. You must pass in the interactive program to run, what the prompt of the program is, and which command quits the program: expect_run( command => "perl testme.pl", prompt => 'testme: ', quit => 'quit', ); expect The expect subroutine is the catch all subroutine. You pass in the command, the expected output of the subroutine and an optional comment. expect("ping", "pong", "expect"); expect_send The expect_send subroutine sends a command to the program. You pass in the command and an optional comment. expect_send("ping", "expect_send"); expect_is The expect_is subroutine tests the output of the program like Test::More's is. It has an optional comment: expect_is("* Hi there, to testme", "expect_is"); expect_like The expect_like subroutine tests the output of the program like Test::More's like. It has an optional comment: expect_like(qr/Hi there, to testme/, "expect_like"); expect_handle This returns the Expect object. expect_quit Closes the Expect handle. SEE ALSO
Expect, Expect::Simple. AUTHOR
Leon Brocard, "<acme@astray.com>" COPYRIGHT
Copyright (C) 2005, Leon Brocard This module is free software; you can redistribute it or modify it under the same terms as Perl itself. perl v5.12.3 2011-06-12 Test::Expect(3pm)
All times are GMT -4. The time now is 03:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy