Auto router reboot script

For some retarded reason my new internet service provider (MTNL) requires me to reboot my router at midnight and 8am to qualify for free unmetered service. Sadly, it makes sense to comply since you can easily download 2-3GB of content a night.  However, there has to be a better way then physically turning off the router and rebooting it every damn night. There had to be a technology angle to getting this going automatically every night. There are a couple utilities for the Mac, however I didn’t want to rely on 3rd party hacks but wanted to use the native tools via OS X. My solution is a bit convoluted but once you implement it, it takes only a couple clicks a night. The apps I used were AppleScript, iCal and the Energy Saver preferences on the Mac.

1. Create 2 scripts: app_start.scpt and router_reboot.scpt (you can download mine: app_start.scpt and router_reboot.scpt).
will start Terminal and telnet to your router
enters a username/pass
issues a reboot command (this assumes a D-Link router)
Starts my favorite BitTorrent client Transmission
Issues a command to update all my podcasts in iTunes

will start Terminal and telnet to your router
enters a username/pass
issues a reboot command 

2. Use iCal to execute the scripts at the time you want them to occur, to do this create an appointment with an alarm and select “run script.” I have the app_start script kickoff at 12:05am and the router_reboot script starts at 7:55am (image below). You can further automate this by creating a repeating event every day.

3. In the System Preference Pane for Energy Saver. I have my Mac awake at 12:05am. (image below)

Finally, before you goto bed put your Mac to sleep. And at 12:05am your Mac will awake and execute the app_start script.  Then at 7:55am, the router_reboot script is executed.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s