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
Copy below lines and save the file
#!/bin/sh -x #Author : Vidyadhar #contact : firstname.lastname@example.org, email@example.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
You can also schedule the script via cronjob.