05-13-2009
[quote=System Shock;302315605]10 seconds is the standard delay for expect. You tell expect to expect something, so expect waits 10 seconds. If it doesn't see it in 10 seconds, it goes to the next line.
That bit of code you posted doesn't make sense to me.
----------------------------------------------------------------------
Thanks rapid response.
I should have been more clear: I posted the log output NOT the script!
Used the code flag to preserve format.
I think you are saying expect always waits the full timeout period!
If this is the case then I still have a problem. I am dealing with thousands of boxes and unless I go to parallel processing I will never get around to all the boxes! Most respond in a second or so but some can take a few seconds if busy. So how do I set my timeout??? If I leave it at the default then that is 10,000 x n seconds where n is the number of send/expect cycles!
I was expecting that the remote box would respond to a command and expect would continue to the next operation immediately upon receipt of the expected response! But I do not see the expected response in the log file until after the timeout has occurred.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have two sripts running in bash. The first one uncompresses log files and moves them to a working directory using uncompress -c and > output to new directory. It then creates one control record to assure our search returns a record. It then calls or executes the second script, which is a grep for... (6 Replies)
Discussion started by: altamaha
6 Replies
2. Shell Programming and Scripting
Somewhat long story:
I have a simple Perl CGI script that uses Expect to Telnet to a device and grab some data, and then spits it back to Perl for display on the Webpage.
This works for many devices I've tried, but one device just fails, it keeps rejecting the password on this device, only... (1 Reply)
Discussion started by: jondo
1 Replies
3. Shell Programming and Scripting
So here is what I am trying to do. I have a large # of switches and routers I am trying to log into. Unfortunately some have ssh only, some have telnet only. and some i have never logged into with ssh. I first want it to SSH, if i have never logged into the box it will ask for adding the ssh key. I... (0 Replies)
Discussion started by: ippy98
0 Replies
4. Shell Programming and Scripting
Hi all,
I have written a small expect script which should spawn a telnet session login and execute some commands.
#!/usr/bin/expect -f
spawn telnet $env(IP)
match_max 100000
expect "login:"
send -- "******\n"
expect -exact "Password:"
send -- "****\n"
expect "%"
Now I have got... (2 Replies)
Discussion started by: stinkefisch
2 Replies
5. Shell Programming and Scripting
Hi All,
I am trying to write a expect script to telnet and run a command on a remote host.The command i want to send contains a text value is contained in file.txt in the linux box from where i am running the expect script.I want to pass the contains of file.txt into a variable and call the... (1 Reply)
Discussion started by: pistachio
1 Replies
6. Shell Programming and Scripting
Hello
I'm working using expect to automate telnet commands...i want to check if telnet fails and in this case...certain message should appear or certain word should be out in a file).
Thses are the messages that apeear if telnet fails:
Trying 172.16.3.115...
telnet: Unable to connect... (0 Replies)
Discussion started by: Hossam_Nox
0 Replies
7. Shell Programming and Scripting
I've got some expect/tcl scripts.
Now i want to add a function that allows to open a telnet connection and redirect the output to a logfile.
On the shell/terminal i tried something like:
'telnet 192.168.123.123 12121 > /home/user/logging/log-telnet.log'
and the telnet is redirected into the... (2 Replies)
Discussion started by: JaPatton
2 Replies
8. Shell Programming and Scripting
At times I find the need to test that the tacacs port 49 is open.
The code below works but is painfully slow because I have to wait on the timeouts.
Examples of possible responds
router1#telnet 10.11.20.14 49
Trying 206.112.204.140, 49 ... Open
route1#telnet 10.11.19.14 49
Trying... (1 Reply)
Discussion started by: popeye
1 Replies
9. Shell Programming and Scripting
Hi All,
I have an Expect script which logs into Cisco switch, performs a show interface command. I want to read a file of ip addresses which will be passed to the expect script.
The script to read the file works, the expect script works on it's own but when i call the 'expect' script from the... (12 Replies)
Discussion started by: trinak96
12 Replies
10. Shell Programming and Scripting
hi, please help, keep getting this bolded error and look it up and people say
its your environment variable though i tried to set it manually in expect..it run fine if i run it manually but once i run it by cronjob it error below..i tried to comment out ip/login info with *..
logfile::
START... (0 Replies)
Discussion started by: cssanangeles
0 Replies
LEARN ABOUT HPUX
evmwatch
evmwatch(1) General Commands Manual evmwatch(1)
NAME
evmwatch - monitor EVM events
SYNOPSIS
show_template]] filter_expr] channel-list] timeout] reconnect-timeout]
DESCRIPTION
The command subscribes to the events specified by the option and passes all events to its stream as they arrive. Output is in the form of
raw EVM events.
If the option is specified, automatically starts and pipes the event stream into it, producing a formatted display of events. If a
show_template argument is supplied, the specified template string is passed to through its own option. See evmshow(1) for more informa-
tion.
If cannot connect to the EVM daemon, it terminates immediately with an error message. If it succeeds in connecting but subsequently loses
the connection, it attempts to reconnect periodically until the reconnect-timeout period expires. The retry period is one second for the
first minute, and five seconds thereafter.
Options
Automatically starts
to produce a formatted display of the received events.
Subscribes for notification of events matching
filter_expr. See EvmFilter(5) for the syntax of filter_expr. By default, the command subscribes for all events.
Template string to be passed to
if the option is also specified. If the option is not specified, this argument is ignored. See evmshow(1) for a description of
the template string.
Terminates if no event is processed in the time specified by
timeout. The format of timeout is [[[dayshoursminutesseconds, where days, hours, and minutes can be any integer up to 9999, and
seconds can be any integer up to 9999999. Omitted values are interpreted as zero. If the converted value exceeds 100,000,000
seconds, it is automatically reduced to that value with no error being reported. The timer is restarted each time an event is
received.
Retrieves copies of all of the registered event templates from the EVM
daemon that match the supplied filter string and for which the user has access authorization. It writes the templates to as EVM
events and terminates.
Terminates with a zero exit value as soon as the first event matching
filter_expr is processed.
Specifies the period for which
should continue to attempt to reconnect if the connection to the EVM daemon is lost. The format of reconnect-timeout is
[[[dayshoursminutesseconds, where days, hours, and minutes can be any integer up to 9999, and seconds can be any integer up to
9999999. Omitted values are interpreted as zero. If the converted value exceeds 100,000,000 seconds, it is automatically
reduced to that value with no error being reported.
If reconnect-timeout is zero, terminates immediately if a disconnection occurs. If this option is not specified, the reconnec-
tion timeout is set to five minutes.
RETURN VALUES
The following exit values are returned:
Successful completion
An error occurred, including timeout.
EXAMPLES
o The following example watches for all events with a priority of at least 200 and displays them on Events are piped automatically through
to produce a formatted event display.
o The following example shows how waits until another process posts a particular event and then continues. Redirection of output to
implies that the content of the event is of no concern.
The following script builds on the prior example. It waits for five minutes (300 seconds) for the event to occur or exits as soon
as the event happens.
o The following shell script waits for up to five minutes (300 seconds) for a pulse event to be received. Each time the pulse arrives,
the timer is reset and waits for the next pulse. If the timer expires, terminates with an error code, a warning is displayed, a high
priority event is posted, and the script exits.
o The following example lists the names of all registered events that the user is authorized to access.
WARNINGS
The command rejects attempts to output raw events to a terminal device.
The command receives events only for which the user has access authorization. See evm.auth(4) for details of access authorization.
FILES
Definition of the sockets and protocols used for Internet Services
SEE ALSO
Commands
evmget(1), evmpost(1), evmshow(1), evmsort(1).
Files
evmfilterfile(4), services(4).
Event Management
EVM(5).
EVM Events
EvmEvent(5).
Event Filter
EvmFilter(5).
evmwatch(1)