Auto Reboot after Specific Hours

I have installed OpenWRT 3.05.3 on TP Link CPE220 v3. I want to reboot my router after specific hours.

Most people are going to advise against that unless you have a very good reason.

Is there a way to only i can enable this?

It is not good practice and I'm not going to encourage it unless you can give a very good reason.

Most likely the problem you think a reboot will fix is fixable another way.

Rebooting your router cleans out the device's short-term memory (also called “cache”) to keep it running smoothly . It also allows the router to re-select the least crowded channel for each frequency, which means a stronger connection to your devices.

This is done automatically if you choose the channel selection to 'auto'.

I do not know where you read that but unless you have something configured wrong and it is poorly handling the cache, it is not true.

https://discover.centurylink.com/why-you-should-reboot-your-router-regularly.html#:~:text=This%20is%20sometimes%20called%20a,stronger%20connection%20to%20your%20devices.

From the page:

One of the simplest and most effective ways to fix the occasional connection issue is to reboot or restart your router. This means turning it off and then back on again, either manually or remotely. Rebooting your router can clear up temporary glitches, free up memory, complete any firmware updates that have been downloaded, and refresh your connection.

If your OpenWRT router is having those issues, rebooting it is not the answer. If you applied a firmware update, it will reboot itself.

But you are welcome to wait and see if someone else will tell you how.

The whole idea with OpenWrt is to not be forced to use the original firmware with these bugs to begin with.

A software reboot has the problem not to get in a continuous loop since the clock is reset with a reboot.

The easiest and actually working way it to mount a timer switch on the power cable.

This space intentionally left blank.

I have Tenda N300 and it has that feature.

That is no feature, just the uniliteral declaration of incompetence.

The forum search will provide you with detailed reasons why that is 'not a solution' (to keep this PG13), as well as hints how to do it nevertheless.

3 Likes

Cron? But again rebooting the router daily is just plain stupid... The cache claim is just bs and at the same level of tool that "clean ram"

There is one note here on your picture, this isn’t a reboot. It is a power down for many hours. The only way that can happen is if the router have a hardware RTC (which is extremely unusual on routers or network equipment in general) or the router isn’t powered down but instead put in some semi sleep mode where the clock keeps on running.

I suspect the reference to 03:00 - 05:00am means the router will reboot sometime during that window. Not that it will turn off at 03:00 and then back on at 05:00.

2 Likes

Listen to the knowledgeable here, not some random link.

My example:

Build Date 10-08-2023

root@OpenWrt:~# uptime
 10:51:33 up 184 days, 23:19,  load average: 0.01, 0.00, 0.00

Never needed a reboot!

Scheduled reboot a router should be very easy, use crontab cmd or simple use luci-app-watchcat.

Btw, I'm thinking a good method to "stop a service" after reboot in 30~60min.
I will try to use the initial script to do it:
https://openwrt.org/docs/guide-developer/procd-init-script-example

It ain’t the reboot initiation that is the problem. It is stopping the reboot loop at boot that is the problem.

May I just point out that the article's author does not even know what a router is?

A router creates a private wireless network and connects your devices to the internet.

You do not have any storage connected nor any USB port, in worst case your cache will be 8MB flash memory sized+2.5MB max dnsmasq cache, If you want to scale past dozen wifi clients probably you need zram-swap to defer killing random processes due to short memory. i.e slowdown better than sporadic process crashes.
For reboot - you can write crontab, but there is absolutely no need to.

1 Like