Spawn_Id: Spawn Id Exp6 Not Open

expect complains that send: spawn id exp6 not open

Notice the "Connection closed by foreign host."

spawn telnet 192.168.1.51 -l root

expect {
"Connection closed by foreign host." {
puts "Telnet session closed unexpectedly."
puts "Please try again."
exit
}
"#"
}

With this form of the expect command, expect is looking for two patterns, and the first one found "wins".

  • if "connection closed" happens, the messages are printed and the program ends
  • if "#" (your prompt) shows up, there's no specific action, so the expect command returns and the rest of your program can carry on

This technique is essential for efficient expect programming where you frequently have to look for multiple patterns.


Looking forward, you might expect to see "Connection closed" at any time: investigate the expect_before command.

getting send: spawn id exp6 not open error

Seperate out echo itsme | sudo -S lvremove #{snap_name}

try this

`/usr/bin/expect <<delim
exp_internal 0
set timeout 20
spawn sudo lvremove #{snap_name}
send "itsme\r"
expect {Do you really want to remove active logical volume #{name}? [y/n]:}
send "y\r"
expect eof
delim`

Expect script error send: spawn id exp4 not open while executing send password

I have already fix it, it was an error in dos2unix command. I had to code it again over Ubuntu for avoiding to run dos2unix command.



Related Topics



Leave a reply



Submit