At home I am using MTNL adsl connection for net surfing. Most of the time I have to reboot the adsl router. To do the same I need to login to the router via telnet and have to run reboot command or have to manually unplug the power cable. To make the task simple, I wrote bash script which will reboot the router by just running the script.

Create one file in your home directory and copy below contents in it

vi ~/router_reboot.sh

Copy below lines and save the file

#!/bin/sh -x
#Author : Vidyadhar
#contact : techienote.com@gmail.com, vidyadhards@gmail.com
#Rebooting the router
##Modify USERNAME, PASSWORD, ROUTER_IP as per your setup
USERNAME=user
PASSWORD=password
ROUTER_IP=router_ip
###Dont modify below lines
(sleep 2; echo "$USERNAME"; sleep 2; echo "$PASSWORD"; sleep 2; echo "reboot"; sleep 10; echo "quit") | telnet $ROUTER_IP
exit

Make the file executable

chmod +x ~/router_reboot.sh

If you want to reboot/restart the router just run

~/router_reboot.sh

You can also schedule the script via cronjob.

Reboot ADSL Router via script

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Recommend on Google