Sponsored Content
Top Forums Shell Programming and Scripting Perl telnet to router run commands from file Post 302873705 by Chubler_XL on Tuesday 12th of November 2013 09:18:54 PM
Old 11-12-2013
Nice work, I've seen many posts here asking for something similar so I know others will find this useful.

The 600 sec timeout is a little long - do you encounter issues with some commands taking a long time to finish? I'd try reduce it to give feedback to users quicker, you can extend it again for the command processing part if needed.

Could be useful putting or die tests on all your waitfor() calls to assist debugging if router/prompts are wrong eg:

Code:
$t->waitfor('/Telnet password[: ]*/i') or die "No router pass prompt";

When doing these type of things I like to change the PS1 prompt to something more unique to ensure we are matching on the command prompt eg:

Code:
$t->print("PS1=READY#  \n");
$t->waitfor('/READY#$/') or die "No command prompt";

This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl telnet to cisco router and compare the ping ms

All Please help, i will telnet to router to obain the ping status and compare, if higher than normal latency, i will have further action.. if i do the telent and in perl script then .... e.g the result i obtain from the router will be =' Success rate is 100 percent (5/5), round-trip... (4 Replies)
Discussion started by: optimus
4 Replies

2. Shell Programming and Scripting

Script to run on a router

I want to make a Perl script to telnet to a router and apply commands, and get the output of the commands in a file. Can any one help me in that? (2 Replies)
Discussion started by: moutaz1983
2 Replies

3. 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

4. UNIX for Dummies Questions & Answers

Command to run multiple commands from a file.

I need a command, which could run mutliple commands from a file. Let's say, I have mv fileA1 fileB1 mv fileA2 fileB2 ..... mv fileA20 fileB20 I put these commands in a file, then I need a command to run the file as a whole so that I don't need to type 20 times... Anyone tell me how to... (8 Replies)
Discussion started by: kaixinsjtu
8 Replies

5. UNIX for Dummies Questions & Answers

check for a file and run some commands

Hi all, Can you guys please help me with this... I am on AIX and need to prepare a script which will 1. check for a file named do_backup in the current file system 2. If the file exists i need to run some commands and exit, if the file doesn't exist then sleep for 15 mins and try... (2 Replies)
Discussion started by: family_guy
2 Replies

6. Shell Programming and Scripting

Telnet to router and execute command

I am trying to write a shell script to execute some commands.. telnet <IP address of the router> wait 10 echo "username" echo "password" sh log exit but i am unable to execute it properly ..please help me .. thanks in advance Sri (1 Reply)
Discussion started by: srikanthus2002
1 Replies

7. Shell Programming and Scripting

Perl: connect to network devices, run set of commands

I am trying to write a script for my own use that will allow me to connect to network devices, then run a set of commands. I start with a list of ips in a text file. Each ip is on its own line. I start with a second file of commands. Each command on one line. for illustration .. the cmd.txt... (2 Replies)
Discussion started by: popeye
2 Replies

8. Linux

How to run commands with pipe from text file?

Hello, I have standard loop while read -r info; do command $info done < info in info text file I have multiple commands each on line that I want to execute. When I used them in console they worked, but not with this loop. This is one of the commands in info file: grep... (4 Replies)
Discussion started by: adamlevine
4 Replies

9. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

10. UNIX for Beginners Questions & Answers

Script require to do telnet & run few commands

I am new in scripting, I need script(BASH) which do telenet to one of the elements & run few commands , after running it successfully it will check status of files & exit. Help is greatly appreciated 🙏 (2 Replies)
Discussion started by: Vinesh_123
2 Replies
mrinfo(1M)																mrinfo(1M)

NAME
mrinfo - Multicast Routing Configuration Information Tool SYNOPSIS
debuglevel] retries] timeout] [ multicast-router ] DESCRIPTION
requests the configuration information from the multicast-ourter, and prints the information to the standard out. multicast-router can be either an IP address or a system name. sends out the ASK_NEIGHBORS igmp message to the specified multicast-router, when the router receives the request, it sends back its configuration information. If the multicast-router is not specified, the request is sent the local router. The the configuration information for each interface is printed in the following format: If there are multiple neighbor routers on one interface, they will all be reported on the output. The possible values for flag are: Neighbors are reached via tunnel. The tunnel uses IP source routing. The interface is down. The interface is administratively disabled for multicast routing. The local router is the querier of the subnet. Please see mrouted(1M) for and The command line options are: Sets the level for printing out the debug message. The default is 0, only error and warning messages will be printed. Debug level three prints most the messages. Sets the retry times to pull the routing daemon for information. The default is 3. Specifies the timeout value in seconds for waiting the reply. The default value is 4. EXAMPLE
The following is an example of quering the multicasting configuration from the local routing daemon. 127.0.0.1 (localhost) [version 3.3]: 15.13.106.144 -> 15.13.106.145 (hpntcbs.cup.hp.com) [10/1/querier] 193.2.1.39 -> 0.0.0.0 (all-zeros-broadcast) [1/1/disabled] 15.13.106.144 -> 15.255.176.33 (matmos.hpl.hp.com) [10/1/tunnel] 15.13.106.144 -> 15.17.20.7 (hpspddc.vid.hp.com) [10/1/tunnel/down] Note must be run as root. AUTHOR
was developed by Van Jacobson. SEE ALSO
mrouted(1M), map-mbone(1M). mrinfo(1M)
All times are GMT -4. The time now is 01:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy