Help needed with expect...(If telnet fails)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed with expect...(If telnet fails)
# 1  
Old 03-22-2010
Help needed with expect...(If telnet fails)

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 to remote host: No route to host

Any suggestions??

edit by bakunin: my suggestion is to leave out "urgent" from the thread titles, as zaxxon already told you (see here). We are volunteers, neither the help desk nor your serfs. If you need someone knowledgeable to do the work for you then, by all means, hire someone. To get an answer from us you should reconsider your attitude.

Last edited by bakunin; 03-22-2010 at 09:46 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling Expect Script - Telnet

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

2. Shell Programming and Scripting

EXPECT script for Telnet automation. Need your support.

Dear experts, please help me . I've found simple EXPECT scripts and all works fine. But I need more automation in error handling and sending list of commands/output logging from multiple remote hosts. I have 10 hosts, for example: host1 192.168.1.1 LOGIN1 PASSWORD1 ...... ... (2 Replies)
Discussion started by: starchen
2 Replies

3. Shell Programming and Scripting

Expect/telnet/testing tacacs on a cisco

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

4. Shell Programming and Scripting

expect: redirect telnet to file

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

5. Shell Programming and Scripting

Need Help with expect when ssh fails

I'm trying to write a script using expect. I'd like the script to execute several commands when the ssh succeeds and i want it to exit if the ssh fails. Does this require to define a time out for the ssh command so that if the prompt is back before this defined time the next commands are executed??... (2 Replies)
Discussion started by: Hossam_Nox
2 Replies

6. Shell Programming and Scripting

telnet commands using expect

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

7. Shell Programming and Scripting

Telnet Expect script question

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

8. Infrastructure Monitoring

expect telnet unexpected delays

I must automatically monitor and manage a large number of boxes on our network. I have been using perl/Net::Telnet and expect/telnet and also perl/ssh and expect/ssh to reach the command line of the remote boxes. Scripts are working but slow. (Yes, I do use SNMP also but many boxes do not... (2 Replies)
Discussion started by: kp2a
2 Replies

9. Shell Programming and Scripting

Need 'expect' help, ssh/telnet and trapping

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

10. Shell Programming and Scripting

Webpage to Telnet via Perl and Expect: Telnet problem?

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
Login or Register to Ask a Question
ipsec_policy(1M)														  ipsec_policy(1M)

NAME
ipsec_policy - HP-UX IPSec policy tester SYNOPSIS
src_ip_addr] dst_ip_addr] src_port] dst_port] DESCRIPTION
is a utility program that allows the HP-UX IPSec Administrator to query the active policy database to determine which host IPsec Policy will be used for an IP packet based on a packet descriptor, or 5-tuple, and the direction. The packet descriptor consists of a source IP address, source port number, destination IP address, destination port number, and network protocol. If the host policy uses dynamic key Security Associations, also displays the authentication record and IKE policy selected. If the authentication record contains two values for the IKE (KMP) version, uses the first value and selects the IKE policy according to this value. If the host policy uses a tunnel pol- icy, also displays the tunnel policy used. requires the optional HP-UX IPSec software. You must have superuser capabilities to run the utility. Command-Line Arguments recognizes the following command-line options and arguments: Specifies the source IP address (src_ip_addr) of the packet. If the direction is out, this is the local IP address. If the direction is in, this is the remote IP address. Acceptable values: An IPv4 address in dotted-decimal notation or an IPv6 address in colon-hexadecimal notation. Default: If you omit the source address and destination address uses the wildcard IPv4 address If you omit the source address but specify the destination address, uses the wildcard IPv4 address or wildcard IPv6 address according to the type of IP address you specify for the destination address. Specifies the source port number (src_port) of the packet. If the direction is out, this is the local port number. If the direction is in, this is the remote port number. Range: An unsigned integer in the range 1 - 65535. Default: Any port number(0). If you are making a query for an outbound client-server application where the source port number can be any user-space port, specify a "dummy" user-space port number for the source port, such as 65535. Specifies the destination IP address (dst_ip_addr) of the packet. If the direction is out, this is the remote IP address. If the direction is in, this is the local IP address. Acceptable values: An IPv4 address in dotted-decimal notation or an IPv6 address in colon-hexadecimal notation. Default: If you omit the source address and destination address uses the wildcard IPv4 address If you omit the destination address but specify the source address, uses the wildcard IPv4 address or wildcard IPv6 address according to the type of IP address you specify for the source address. Specifies the destination port number (dst_port) of the packet. If the direction is out, this is the remote port number. If the direction is in, this is the local port number. Range: An unsigned integer in the range 1 - 65535. Default: If omitted, any port number is assumed. If you are making a query for an inbound client-server application where the client port number can be any user-space port, specify a "dummy" user-space port number for the destination (server) port such as 65535. Specifies the network_protocol of the packet. Acceptable values: (Mobile IPv6 Mobility Header), or Default: Any network protocol(0). Specifies the direction for the packet specification. Acceptable values: or Default: RETURN VALUE
Upon successful completion, returns 0; otherwise it returns 1. ERRORS
fails if any of the following conditions is encountered: o Command used incorrectly - Usage message is returned. o HP-UX IPSec subsystem is not running - returns the following message: EXAMPLES
IPv4 Example On system A you want to determine which host IPsec policy will be used for outbound telnet traffic to system B or when local users telnet to system B. Since the telnet clients on system A will use any unused user-space TCP port and the telnet daemons on system B will use TCP port 23, you could use the following command: On system A you want to determine which host IPsec policy will be used for inbound telnet traffic from system B or when users on system B telnet to the local system. Since the local telnet daemons will use TCP port 23 and clients on system B will use any unused user-space TCP port, you could use the following command: IPv6 example On system A you want to determine which host IPsec policy will be used for outbound telnet traffic to system B or when local users telnet to system B. Since the telnet clients on system A will use any unused user-space TCP port and the telnet daemons on system B will use TCP port 23, you could use the following command: On system A you want to determine which host IPsec policy will be used for inbound telnet traffic from system B or when users on system B telnet to the local system. Since the local telnet daemons will use TCP port 23 and clients on system B will use any unused user-space TCP port, you could use the following command: WARNINGS
requires the optional HP-UX IPSec software. AUTHOR
was developed by HP. SEE ALSO
ipsec_admin(1M), ipsec_config(1M), ipsec_config_add(1M), ipsec_config_batch(1M), ipsec_config_delete(1M), ipsec_config_export(1M), ipsec_config_show(1M), ipsec_migrate(1M), ipsec_report(1M). HP-UX IPSec Software Required ipsec_policy(1M)