• March 31, 2020, 01:10:31 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

This Forum Beta is ONLY for registered owners of D-Link products in the USA for which we have created boards at this time.

Pages: [1] 2

Author Topic: How to reboot router using a script?  (Read 29351 times)

luckyboy

  • Level 1 Member
  • *
  • Posts: 6
How to reboot router using a script?
« on: January 31, 2010, 12:56:51 AM »

Hi guys,

is there a way how to reboot DIR 615 using some kind of script?
From time to time I need to reboot the router and I would love to have some automated tool for this.

I also have Dlink DNS 323 and somebody discovered a way how to shutdown it down using Wget:

set UNAME=username
set PASSWD=password
set IP=NAS IP
set WGETPATH=path to wget.exe

"%WGETPATH%"  --tries=1 --timeout=5 "http://%IP%/goform/formLogin?f_login_type=0&f_LOGIN_NAME=%UNAME%&f_LOGIN_PASSWD=%PASSWD%"
IF %ERRORLEVEL%==0 (
"%WGETPATH%" --tries=1 --timeout=5 "http://%IP%/goform/sysShutDown?shootdown"
) ELSE (
   ECHO Unable to shutdown NAS Server!
)

It should be possible to call reboot for DIR 615 as well, but Im not able to find out...  :-[

Help would be really appreciated!
Logged

rrgrover

  • Level 1 Member
  • *
  • Posts: 1
Re: How to reboot router using a script?
« Reply #1 on: October 19, 2011, 01:34:57 PM »

Bump!
I agree!
This would be Really usefull

Anyone know how to do this?
Thanks
Russ
Logged

marc

  • Level 1 Member
  • *
  • Posts: 7
Re: How to reboot router using a script?
« Reply #2 on: January 03, 2014, 03:38:32 PM »

hi all

i wrote an autohotkey script that uses html with javascript to automatically login and reboot the dir-615 router.

+++ download RouterReboot.zip via www +++

+++ download RouterReboot.zip via ftp +++

zip file includes compiled .exe and source code as well.


edit:
* new version 0.1.1 supports any router if appropriate html files are provided

* version 0.2.1
stores router data in an .ini file instead of using html
email support for adding a router (see readme)
« Last Edit: February 07, 2014, 07:54:52 PM by marc »
Logged

FurryNutz

  • Poweruser
  •   ▲
    ▲ ▲
  • *****
  • Posts: 48520
  • D-Link Global Forum Moderator
    • Router Troubleshooting
Re: How to reboot router using a script?
« Reply #3 on: January 03, 2014, 04:57:57 PM »

Can this be modified for any router?
Logged
"Nothing Funny about It...." We are not here to Impress anyone! You have a be a COMPETENT user first to under stand COMPETENT help!

marc

  • Level 1 Member
  • *
  • Posts: 7
Re: How to reboot router using a script?
« Reply #4 on: January 04, 2014, 12:07:18 PM »

the login part should be suitable, the script uses a simplified html code of the router's login page. i'm not sure about the reboot command. it's composed of two javascript functions in the router's corresponding html page.
Logged

FurryNutz

  • Poweruser
  •   ▲
    ▲ ▲
  • *****
  • Posts: 48520
  • D-Link Global Forum Moderator
    • Router Troubleshooting
Re: How to reboot router using a script?
« Reply #5 on: January 05, 2014, 09:09:27 AM »

Thanks for the info, I'll have a look at it and see if maybe we can make it configurable for other models...i may contact you again...Thanks for sharing.
Logged
"Nothing Funny about It...." We are not here to Impress anyone! You have a be a COMPETENT user first to under stand COMPETENT help!

marc

  • Level 1 Member
  • *
  • Posts: 7
Re: How to reboot router using a script?
« Reply #6 on: January 05, 2014, 12:53:07 PM »

Assuming there's some interest I modified the script by taking the html code out and putting it in two seperate files. This way support for any router can be added easily as long as it's possible to login and reboot it automatically by using html and javascript.
« Last Edit: January 05, 2014, 01:02:57 PM by marc »
Logged

FurryNutz

  • Poweruser
  •   ▲
    ▲ ▲
  • *****
  • Posts: 48520
  • D-Link Global Forum Moderator
    • Router Troubleshooting
Re: How to reboot router using a script?
« Reply #7 on: January 05, 2014, 01:03:55 PM »

Any what of letting the user select a particular model with in the .exe? I presume this might need more code dev or information based on models...most DIR series routers have the same manual Boot location under Tools/System...
Logged
"Nothing Funny about It...." We are not here to Impress anyone! You have a be a COMPETENT user first to under stand COMPETENT help!

marc

  • Level 1 Member
  • *
  • Posts: 7
Re: How to reboot router using a script?
« Reply #8 on: January 05, 2014, 01:19:39 PM »

most DIR series routers have the same manual Boot location under Tools/System...

... sounds like it could work for many routers.

The .exe reads variables from an .ini file. Variables are

model
username
password
routerip
wait

Logging in and rebooting is done by sending two different urls. To add support for a certain model, you have to create a folder with the same name as the router model and put two html files in it.
Logged

FurryNutz

  • Poweruser
  •   ▲
    ▲ ▲
  • *****
  • Posts: 48520
  • D-Link Global Forum Moderator
    • Router Troubleshooting
Re: How to reboot router using a script?
« Reply #9 on: January 05, 2014, 01:26:31 PM »

And could the .exe tell which folder to use or could be point it to a specified folder?
Logged
"Nothing Funny about It...." We are not here to Impress anyone! You have a be a COMPETENT user first to under stand COMPETENT help!

marc

  • Level 1 Member
  • *
  • Posts: 7
Re: How to reboot router using a script?
« Reply #10 on: January 05, 2014, 01:43:14 PM »

The new folder has to be in the folder "routers" which is located in the scripts directory. To make the .exe use those html files write the name of the router model into the .ini file ("model=DIR-615"). The folder must have this name as well.
Logged

FurryNutz

  • Poweruser
  •   ▲
    ▲ ▲
  • *****
  • Posts: 48520
  • D-Link Global Forum Moderator
    • Router Troubleshooting
Re: How to reboot router using a script?
« Reply #11 on: January 05, 2014, 01:44:33 PM »

Is the .ini file editable to users, i.e. changing the DIR-615?
Logged
"Nothing Funny about It...." We are not here to Impress anyone! You have a be a COMPETENT user first to under stand COMPETENT help!

marc

  • Level 1 Member
  • *
  • Posts: 7
Re: How to reboot router using a script?
« Reply #12 on: January 05, 2014, 01:46:41 PM »

Is the .ini file editable to users, i.e. changing the DIR-615?

Of course it is, you have to put username and password in it.
Logged

FurryNutz

  • Poweruser
  •   ▲
    ▲ ▲
  • *****
  • Posts: 48520
  • D-Link Global Forum Moderator
    • Router Troubleshooting
Re: How to reboot router using a script?
« Reply #13 on: January 05, 2014, 01:49:43 PM »

Ok, thank you for this information...I hope users will enjoy it as there has been some users asking about it.

Logged
"Nothing Funny about It...." We are not here to Impress anyone! You have a be a COMPETENT user first to under stand COMPETENT help!

marc

  • Level 1 Member
  • *
  • Posts: 7
Re: How to reboot router using a script?
« Reply #14 on: January 05, 2014, 09:52:38 PM »

I just stumbled upon the initial question of the thread, so i make up the basic info now although it's four years ago (what happened in four years?):

loginurl="http://routerip/login.php?ACTION_POST=LOGIN&LOGIN_USER=username&LOGIN_PASSWD=password"

rebooturl="http://routerip/sys_cfg_valid.xgi?exeshell=submit REBOOT"

 :o
Logged
Pages: [1] 2