Scheduled reboot does not work. Why?

Yes, I know there are other posts on this, but I don't solve my problem.

I need to automatically turn wifi on and off at night. Also, I want to restart the router daily between wifi off and on activity. I think of using a command like this:

crontab -e
41 15 * * * / sbin / wifi down
42 15 * * * / sbin / wifi on

with e.g.

In 18.06 it seems to work but now not 19.07. Why?

My previous ideas were:
00 02 * * * / sbin / wifi down
00 06 * * * / sbin / wifi on
30 05 * * * / sbin / reboot
crontab -e
with e.g.
but the router starts continuously.

Any idea of work?

See https://openwrt.org/docs/guide-user/base-system/cron#periodic_reboot

Is there a space around each slash?

1 Like

Also rebooting is going to bring the wifi back up, or is that what you wanted to happen?

1 Like

Solved using app wifischedule but i want also to reboot the router daily . Here the sheduled task created by the app :

00 06 * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifi_schedule.sh start
00 06 * * Sat,Sun /usr/bin/wifi_schedule.sh start
15 02 * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifi_schedule.sh forcestop
15 02 * * Sat,Sun /usr/bin/wifi_schedule.sh forcestop

Any command to reboot every day without continuously rebooting? Yes, there seems to be a space around each bar, but I don't know why I needed to make a factory default.

This is explained in https://openwrt.org/docs/guide-user/base-system/cron#periodic_reboot which @tmomas already mentioned.

You need to sleep at least 1 minute before rebooting otherwise the reboot job will execute immediately again after reboot because the clock is restored to the same minute.

2 Likes

yes ok thank you . So can i reboot the reboot the router between the WiFi off time for example:

00 06 * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifi_schedule.sh start
00 06 * * Sat,Sun /usr/bin/wifi_schedule.sh start
15 02 * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifi_schedule.sh forcestop
15 02 * * Sat,Sun /usr/bin/wifi_schedule.sh forcestop
50 05 * * * / sbin / reboot

It's ok ?

:open_mouth:

Have you read the link about rebooting yet?

No, your router will continuously reboot; and you already know this. Where are your touch and sleep commands?

Plesse re-read Post No. 2 and Post No. 6. Feel free to ask more questions if you are still not clear on why your reboot cron command needs to be fixed.

1 Like

Sorry but I'm not very practical for this type of settings. I know that a few months ago I had entered a command that worked without going into continuous reboot. I tried Watchcat and it's a half solution. The problem with watchcat is that if I want to do a daily reboot (therefore reboot every 24h) for example 3 AM I have to give the command at the same time but I am sleeping at that time. So without lengthening the discussion too much I ask: Since as I said above I had a simple command very similar or perhaps identical to: 50 05 * * * / sbin / reboot and it worked for at least a month then for some reason it stopped working, my question is: Is it possible to set the command that at a certain hour of 24 hours the router will restart itself yes or no? From what I read it seems to me not. If, on the other hand, it is possible to ask if you indicate the full command to put. Isn't it appropriate to implement a clock inside the firmware? Thank you.

Yes. As per the many answers above.
What aren't you understanding?

I'll link it for the third time:
https://openwrt.org/docs/guide-user/base-system/cron#periodic_reboot
The bit that everyone is trying to tell you is that "reboot" is not enough. As per the article, you need to also sleep first so that you don't end up in an infinite reboot loop.
sleep 70 && touch /etc/banner && reboot

And not to confuse you further, but have you considered that when you reboot your wifi will turn back on with your current method?

3 Likes

The full command, based on @stevenausak's last example above would be:

50 05 * * * sleep 70 && touch /etc/banner && reboot

I wanted to be very clear in case: the OP doesn't yet understand why it is necessary, hasn't read the WIki link, etc...

OK thank you guy . I will try!.

Well guy, seem to work! The correct format i used is :

mm hh * * Sat,Sun /usr/bin/wifi_schedule.sh forcestop
mm hh * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifi_schedule.sh start
mm hh * * Sat,Sun /usr/bin/wifi_schedule.sh start
mm hh * * Mon,Tue,Wed,Thu,Fri /usr/bin/wifi_schedule.sh forcestop
mm hh * * * sleep 70 && touch /etc/banner && reboot

This configuration permit me to have different wifi scheduling between workday and weekend and furthermore reboot daily!. I therefore believe that manually entering these parameters on system / scheduled task the installation of wifischedule app is useless. Can you confirm it? Thank you all.

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