i am trying to write an except script to ssh into a list of devices and run some commands, and i came across this problem, not every device is alive, which breaks the script, my script looks like this
following is the error message i got, apparently expect runs across a dead ip and it times out and *continue* to run the next command in the script, how can i fix this? thanks
Last edited by Scott; 02-02-2010 at 03:06 PM..
Reason: Please use code tags
I tend to write expect scripts using a loop, that way it can handle repeat questions and unexpected events rather than getting stuck when things don't occur in the correct order, the classic example is using expect to answer questions from fsck, can't remember where I found this example but it illustrates the point:
In your case you could use the lines (plus others):
So it can then continue onto the next machine
I don't think this can handle the expect EOF followed by "#" that you are doing though...
Whether while statement can be nested in expect I'm not sure.
An idea that might be no good, but I thought I'd suggest it just in case?
Hello,
I'm doing a simple script with expect (a telnet which works without user/pass), and I want to put a condition if timeout happens, then to print a message, but it doesn't work. The script looks like below:
#!/usr/bin/expect
log_user 0
set timeout 10
spawn telnet IP PORT
send... (3 Replies)
Hi
I'm writing a script which based on a condition, restarts a set of servers. The problem I'm facing is, say if one of the server is down, my script stops there and fails to proceed. How can I ensure to set a timeout value on that script, so when the server is not reachable, the script should... (2 Replies)
Hi,
The server is Redhat 5 32bit.
It is not easy to produce the problem so I will just write the experienced problems not how it is produced.
1) During login, it shows the last login time and then waits for 3-4 seconds to give shell prompt (considerable)
2) Sometimes the connection window... (2 Replies)
hello All,
I am doing SFTP using expect. We just change our server from sun solaris 8 to sun solaris 10.
The script was working good on sun solaris 8.
But it is giving problem on 10. from shell, SFTP is working fine.Please help me.
What can be the problem.
LIB_sftp_get()
{
... (0 Replies)
When I run a script where the 1st parameter is ip address
ftp -n -i -v $1
I hang here if the ip is wrong
how to set a timeout something like
if (20s not complete "ftp -n -i -v $1") then
echo "error"
fi
Thanks a lot. (14 Replies)
Hi...
This is message that occurs when i am trying to shutdown the linux system
timeout opening writing control channel /dev/initctl
how can i shutdown what is the problem here..
Thanks in advance
... (2 Replies)
Hi
can anyone help with the following:-
when sending large e-mails via a ssh session the job always times out every 5 min before the mail is sent, this means that a user has to tap a key to stop it timming out. Is there a way to stop this from happening.
Numpty (4 Replies)