Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
   Compare ISP   Rate your ISP
   Glossary   Glossary
Please login or register.

Login with username, password and session length
Advanced search  


Author Topic: Another expect script to force a re-sync without re-booting the router  (Read 1688 times)


  • Kitizen
  • ****
  • Posts: 3303

I knocked up this expect script in order to be able to force the HG612 to re-sync without doing a re-boot, as there is no re-sync option currently that I've found in the gui for this router. Saves me having to remember the syntax! Same thing applies as for the previous script, on Windows it may work if you install the Expect package, Linux users may find it is a default package on stuff like Fedora (but apparently not on Debian). Save as  someting like HG612-resync.expect (and set execute permssion on Linux)

Code: [Select]
#!/usr/bin/expect -f
# Expect script to supply root/admin password for remote ssh server
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit for more information.
# ----------------------------------------------------------------------
# This script will force a re-sync without the need for a re-boot of the router.
# It does this by issuing the xdslcmd to take down and then bring up the connection.
# set Variables
set command [lrange $argv 0 0]
set timeout -1   
stty echo
send_user -- "Enter IP address of router: "
expect_user -re "(.*)\n"
send_user "\n"
stty echo
set ipadd $expect_out(1,string)
spawn telnet $ipadd
match_max 100000

expect "*Login:"
send -- "admin\r"
expect "*?assword:"
send -- "admin\r"
expect "ATP>"
send -- "sh\r"
expect "# "
send -- "\r"
expect "*# "
send -- "xdslcmd connection --down\r"
expect "*# "
sleep 2
send -- "xdslcmd connection --up\r"
expect "*# "
send -- "exit\r"
expect "ATP>"
send -- "exit\r"
expect eof

ISP:TalkTalk Connection:FTTC Cab:ECI Router:Netgear D6220


  • Administrator
  • Senior Kitizen
  • *
  • Posts: 39633
  • Penguins CAN fly
    • DSLstats
Re: Another expect script to force a re-sync without re-booting the router
« Reply #1 on: December 30, 2012, 02:41:35 PM »

Another useful one. I don't want to re-sync right now, but I'll give it a try soon.