Reply

needed to auto reboot R8500

xtrap225
Tutor

needed to auto reboot R8500

i wanted to reboot my router once a week, while i was sleeping on Sunday before starting my work week on monday.  that way i could hopefully exclude that as a necessary step to any issues i woke up to.

 

anyway nothing on this site worked, so i had to come up with this, and i wanted to share, to hopefully save others time.

 

i run this shell script on cron from a server within my network.

 

<PASSWORD> is my cleartext password i login with to my router.

<REDACTED> is the Base64 of the plain text username and password, and doesn't change unless the username or password changes, but i still couldn't get the script to work using just this value and found i needed to obtain it, i.e do a login each time.

 

if anyone wants to fix this script so i only need to use the base64 instead of the plain text login that would be welcome information.

 

#!/bin/bash
### commands for rebooting R8500 router from Linux terminal using curl ####

# Step One - basic auth
# curl -sLIXGET -c cookie -u "admin:<PASSWORD>" 'http://192.168.1.1/start.htm'

# Step Two - get session id
# id=$(curl -s -b cookie -L -H -X GET http://192.168.1.1/ADVANCED_home2_tri_band.htm -H 'Authorization: Basic <REDACTED>' | grep newgui_adv_home.cgi | cut -c 39-102)

# Step Three - reboot router using session id
# curl -s -b cookie -L -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Basic <REDACTED>' -X POST http://192.168.1.1/newgui_adv_home.cgi?id="$id" -d buttonSelect=2&wantype=dhcp&enable_apmode=0

# all three steps at once.

curl -sLIXGET -c cookie -u "admin:<PASSWORD>" 'http://192.168.1.1/start.htm' && id=$(curl -s -b cookie -L -H -X GET http://192.168.1.1/ADVANCED_home2_tri_band.htm -H 'Authorization: Basic <REDACTED>' | grep newgui_adv_home.cgi | cut -c 39-102) && curl -s -b cookie -L -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Basic <REDACTED>' -X POST http://192.168.1.1/newgui_adv_home.cgi?id="$id" -d buttonSelect=2&wantype=dhcp&enable_apmode=0

Model: R8500|Nighthawk X8 Tri-Band AC5300 WiFi Router
Message 1 of 1
Top Contributors
Discussion stats
  • 0 replies
  • 388 views
  • 1 kudo
  • 1 in conversation
Announcements

Orbi WiFi 6E