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 ~/

Copy below lines and save the file

#!/bin/sh -x
#Author : Vidyadhar
#contact :,
#Rebooting the router
##Modify USERNAME, PASSWORD, ROUTER_IP as per your setup
###Dont modify below lines
(sleep 2; echo "$USERNAME"; sleep 2; echo "$PASSWORD"; sleep 2; echo "reboot"; sleep 10; echo "quit") | telnet $ROUTER_IP

Make the file executable

chmod +x ~/

If you want to reboot/restart the router just run


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 *