CRON Problem on OpenWRT

Hi. I am using:

Powered by luci openwrt-22.03 branch (git-23.093.57104-ce20b4a) / OpenWRT 22.03.5 r20134-5f15225c1e

I'm trying to set up a network reboot every 90 minutes, adding a task to the cron

*/90 * * * * /etc/init.d/network restart

However, for some reason, the task runs every hour (60 minutes) not 90. Tell me, please, what am I doing wrong?

Before discussing the details of cron, I want to ask this -- can you describe why you want to restart the network service every 90 minutes? If you're experiencing an issue, restarting the service is only masking the problem... it's best to try to solve the root cause.


Welcome to the community!

I think the issue is a misunderstanding of cron syntax. The only integers available for the minute section are 0-59. If I recall correctly and consider the invalid portion - your syntax seems to say "run on the 90th minute of every hour".

0 0-21/3 * * * /etc/init.d/network restart
30 1-22/3 * * * /etc/init.d/network restart




Thank you for your answers. Rebooting the network is given as an example. I plan to restart the VPN service. Please tell me the correct syntax to run every 90 minutes. Thank you.

Already above by @lleachii ...

You can't do "every 90 minutes" on one line.

Every 59 minutes (the max minutes value) would be
*/59 * * * * /etc/init.d/network restart

Every 120 minutes (2 hours) would be
0 */2 * * * /etc/init.d/network restart

But every 1,5 hours is difficult, as 90 minutes exceeds the 60 minutes of one hour...


I'll ask again -- is this to resolve a problem? One totally reasonable scenario would be if you want it to restart because new peers were added to wireguard... wireguard needs to be restarted to pick up the new peers, so doing this on a cadence if you have constant additions to the interface would make some sense (I could see a scenario where a user gets added and it will be active within 90 mins)...

but if you're trying to fix a problem, we should look to solve the root cause.

@lleachii gave you that answer already.

1 Like

Thanks for the help guys. Everything worked out and works as it should.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.