Solved

Adtran router reboot via TCL scrip

Posted on 2008-10-23
3
1,037 Views
Last Modified: 2013-11-22
I'm looking for some guidance on a tcl script to reboot a router should an interface go down. Can anyone point me in the right direction?

Thanks,

Brad
0
Comment
Question by:bctel
3 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 22827230
is there a specific reason to do it with Tcl?
0
 
LVL 1

Accepted Solution

by:
tinh20012002 earned 500 total points
ID: 23369360
I used Activetcl 8.4.19 from activestate.com.  Make sure you select the free version package.  
This package.  After installation (on windows). you write the scripts similar to this:
----
package require Expect;
# telnet the to router and check interaface.  #If down reboot router. # need minor modification to fit your #Environment.  
spawn telnet $Router_IP;
      expect "user: "; send "username\r";   expect "Password: "; send "pwd\r";
      expect -re "#"; sleep 3 ; # the "#" here  is the prompt of your router      
      set expect_out(buffer) "";
      send "place the command to checkk routeer interace here";       
      expect -re "#"; sleep 2; set test_buff $expect_out(buffer);
      if { [regexp "down" $test_buff ] == 1 } {
            puts "interface status: $test_buff"
            send "reboot cmd \r";       expect -re "w\confirm";       send "Y \r"
      }      

# you can also use Linux completely, or cywgin for windows.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Cisco Router DMZ 5 57
Forwarding web requests to different web servers 15 77
Automating a script for user accounts LINUX 14 68
2 routers, one cable modem 10 85
In the world of WAN, QoS is a pretty important topic for most, if not all, networks. Some WAN technologies have QoS mechanisms built in, but others, such as some L2 WAN's, don't have QoS control in the provider cloud.
Getting hacked is no longer a matter or "if you get hacked" — the 2016 cyber threat landscape is now titled "when you get hacked." When it happens — will you be proactive, or reactive?
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now