D-Link Forums

The Graveyard - Products No Longer Supported => Routers / COVR => DIR-615 => Topic started by: luckyboy on January 31, 2010, 12:56:51 AM

Title: How to reboot router using a script?
Post by: luckyboy 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!
Title: Re: How to reboot router using a script?
Post by: rrgrover on October 19, 2011, 01:34:57 PM
Bump!
I agree!
This would be Really usefull

Anyone know how to do this?
Thanks
Russ
Title: Re: How to reboot router using a script?
Post by: marc 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 +++ (http://321.endofinternet.org/routerreboot/index.html)

+++ download RouterReboot.zip via ftp +++ (ftp://routerreboot:download@321.endofinternet.org)

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)
Title: Re: How to reboot router using a script?
Post by: FurryNutz on January 03, 2014, 04:57:57 PM
Can this be modified for any router?
Title: Re: How to reboot router using a script?
Post by: marc 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.
Title: Re: How to reboot router using a script?
Post by: FurryNutz 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.
Title: Re: How to reboot router using a script?
Post by: marc 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.
Title: Re: How to reboot router using a script?
Post by: FurryNutz 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...
Title: Re: How to reboot router using a script?
Post by: marc 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.
Title: Re: How to reboot router using a script?
Post by: FurryNutz 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?
Title: Re: How to reboot router using a script?
Post by: marc 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.
Title: Re: How to reboot router using a script?
Post by: FurryNutz on January 05, 2014, 01:44:33 PM
Is the .ini file editable to users, i.e. changing the DIR-615?
Title: Re: How to reboot router using a script?
Post by: marc 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.
Title: Re: How to reboot router using a script?
Post by: FurryNutz 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.

Title: Re: How to reboot router using a script?
Post by: marc 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
Title: dOE
Post by: jan.renzlow on May 27, 2014, 07:06:18 AM
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
Title: Re: dOE
Post by: FurryNutz on May 27, 2014, 07:09:36 AM
Yes?  ???

Title: Re: How to reboot router using a script?
Post by: jan.renzlow on May 27, 2014, 07:18:41 AM
I just open this thread http://forums.dlink.com/index.php?topic=59519.0 (http://forums.dlink.com/index.php?topic=59519.0) thanks
Title: Re: How to reboot router using a script?
Post by: FurryNutz on May 27, 2014, 07:30:35 AM
 ;)

I just open this thread http://forums.dlink.com/index.php?topic=59519.0 (http://forums.dlink.com/index.php?topic=59519.0) thanks
Title: Re: How to reboot router using a script?
Post by: m3fisto on September 01, 2016, 11:33:21 PM
I just registered to add how I did it with my D-Link DHP-1565

Code: [Select]
curl -v  --max-time 10 --connect-timeout 1 -u admin:pswd http://192.168.0.1/reboot.cgi -d "html_response_page=count_down.asp&html_response_return_page=tools_system.asp&html_response_message=The Reboot running&result_timer=50&action=reboot" > /dev/null

I hope it helps on other routers too!!
Title: Re: How to reboot router using a script?
Post by: FurryNutz on September 02, 2016, 07:22:29 AM
Thanks for posting this information.

Can you give more detail on how this code is actually executed? What are the exact step and what application(s) are needed?

I just registered to add how I did it with my D-Link DHP-1565

Code: [Select]
curl -v  --max-time 10 --connect-timeout 1 -u admin:pswd http://192.168.0.1/reboot.cgi -d "html_response_page=count_down.asp&html_response_return_page=tools_system.asp&html_response_message=The Reboot running&result_timer=50&action=reboot" > /dev/null

I hope it helps on other routers too!!