DrayTek UK Users' Community Forum

Help, Advice and Solutions from DrayTek Users

Automated Reboots...

More
22 Mar 2010 20:45 #61303 by yoshino
Replied by yoshino on topic Automated Reboots...

paul_1011 wrote: Glad you are still finding it useful!

blog is at http://www.tachytelic.net

I was thinking of adding this script to the blog actually, I think its quite a neat bit of code.

Nice blog dude - definitely bookmarking that one! :mrgreen:

Thanks again

Please Log in or Create an account to join the conversation.

More
24 May 2010 11:11 #62102 by linker3000
Replied by linker3000 on topic Automated Reboots...
Wow, an old thread but just what I was looking for - this has saved me a bit of time reinventing the wheel so many thanks to the OP.

I have modified the scripts so you can add a port number and password to your router list in the form: ipadd/url portnumber password.

eg: myrouter.here.com 7023 mypassword

Plus if you want to take a router off the list temporarily, you can just add a hash in front of its name eg: #myrouter.here.com 7023 mypassword

There's also a little bit extra to cope with blank lines in the router list file.

draytekreboot.sh:


Code:
while read line do echo -e "$line \n" if [ ! "$line" = "" ] ; then if [ ! "x${line:0:1}" = "x#" ] ; then ./draytekreboot.exp $line fi fi done


draytekreboot.exp

Code:
#!/usr/bin/expect -f set sitename [lindex $argv 0] set siteport [lindex $argv 1] set sitepw [lindex $argv 2] set force_conservative 1 ; ; if {$force_conservative} { set send_slow {1 .1} proc send {ignore arg} { sleep .1 exp_send -s -- $arg } } set timeout 20 spawn telnet $sitename $siteport match_max 100000 expect "\rPassword: " send -- "$sitepw\r" expect -exact "\r> " send -- "sys reboot\r"

Please Log in or Create an account to join the conversation.

  • paul_1011
  • Topic Author
  • Offline
  • New Member
  • New Member
More
24 May 2010 11:19 #62103 by paul_1011
Replied by paul_1011 on topic Automated Reboots...
Thats tasty, I like it. I'm not using the shell script anymore but its a nice enhancement.

Please Log in or Create an account to join the conversation.

More
27 Jan 2011 12:31 #65901 by cifer
Replied by cifer on topic Automated Reboots...
Just a word of warning on rebooting routers, If you reboot your router every day for 3 days in a row on an ADSL Max/2/2+ line BT will attempt to retrain the line from scratch, great every few months but not every day of the week, especially if you are having a problem with the line. a reboot every weekend normally solves most issues i have found

Please Log in or Create an account to join the conversation.

Moderators: ChrisSami