Is there anyway to make the Digi Transport WR21 to perform an automatic reboot after 24h? I need it as a saftey precaution to make sure that it goes online again after the network has been down.
Hi you can write a ScriptBasic -program to reboot the router and then setup an autocmd to run the script with options
'=======================================
'rebootat.sb
'=======================================
’ rebootat.sb: causes the Sarian to reboot at a specified time.
’
’ Usage: bas rebootat.sb hh:mm
’
’ To run at startup: cmd 0 autocmd “bas rebootat.sb hh:mm”
’
’ This works by calculating the necessary delay (in minutes), and
’ then running the “reboot n” command
’
const nl = "
"
’
’ Function to put an event in the eventlog
’
function MsgNonFatal(msg)
local junk
junk = system(“setevent "” & msg & “"” & " 0")
print msg, nl
end function
initial_time = command()
’ initialise the initial on/off time
if initial_time <> “” then
split initial_time by “:” to daily_hour, daily_min
if val(daily_hour) < 0 OR val(daily_hour) > 23 OR val(daily_min) < 0 OR val(daily_min) > 59 then
MsgNonFatal(“REBOOTAT: invalid time (” & initial_time & “), ignored”)
initial_time = “”
stop
else
’ print "REBOOTAT: Time set to ", daily_hour, “:”, daily_min, "
"
’ MsgNonFatal(“REBOOTAT: Time=” & initial_time)
endif
else
MsgNonFatal(“REBOOTAT: reboot time not set”)
stop
endif
tnow = GmTime()
’ MsgNonFatal("Time now is: " & FormatDate(“YEAR-0M-0D 0H:0m:0s”, tnow))
treboot = timevalue(year(tnow), month(tnow), day(tnow), val(daily_hour), val(daily_min), 0)
if treboot < tnow then
treboot = treboot + 86400
endif
’ calculate how many minutes before reboot
’
mins_delay = (treboot-tnow)\60 + 1
’ MsgNonFatal(“REBOOTAT: Delay before reboot=” & treboot-tnow & " secs")
MsgNonFatal(“REBOOTAT: Delay before reboot=” & mins_delay & " mins")
junk = system("reboot " & mins_delay)
stop
'=======================================
here is the autocmd
cmd 0 autocmd “bas rebootat.sb hh:mm”
config 0 save
but where do you put the :
cmd 0 autocmd “bas rebootat.sb hh:mm”
config 0 save
If you are not to bothered about time it reboots you can set a reboot to be in 1440 minutes which is 24 hours
cmd 0 autocmd “reboout 1440”
config 0 save
after reboot the router will start a count down to reboot
OK but where do it put this command. I understand what to type in bit not where to type it…
if you telnet / ssh in to the router or from the GUI
you can use execute commands to carry this out
or you can go to configuration system general there is autocommands section and add the reboot 1440 there then save and reboot
I am using a WR 21, went to system, general, command and I set reboot 4. Yes 4 minutes for testing, but I did not work. Can you help me or anyone?
Do you have a screen shot of what you set? It will just work through the above method.