Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shedule task not start #5184

Closed
mikko70 opened this issue Jul 12, 2021 · 8 comments
Closed

Shedule task not start #5184

mikko70 opened this issue Jul 12, 2021 · 8 comments

Comments

@mikko70
Copy link

mikko70 commented Jul 12, 2021

In sheduled tasks show note "Note: you need to manually restart the cron service if the crontab file was empty before editing."
I have TP-link c7 v2 and i must do manual Cron restart every time i change shedule time or something there.
I hope add automated cron restart every time i press save button. Then this cause smaller amount confused questions with new users like me.
Device: TP-link C7 V2
Version : openwrt-ath79-generic-tplink_archer-c7-v2-squashfs-sysupgrade (10.july.2021)

@mikko70
Copy link
Author

mikko70 commented Jul 12, 2021

shedule

@professor-jonny
Copy link

professor-jonny commented Jul 12, 2021

How it says is how it works.
On boot if the cron is empty the task closes, if not it runs.
Rebooting the device enables the service you can also start the cron service from ssh by issuing the following command:
service cron restart

You could also control interfaces instead of wifi globally this will only disable some wifi interfaces and leave the other's active:

#0/10 23 * * * uci set wireless.wifinet2.disabled=1; uci commit; wifi
#0/10 23 * * * uci set wireless.wifinet3.disabled=1; uci commit; wifi
#0/10 7 * * * uci set wireless.wifinet2.disabled=0; uci commit; wifi
#0/10 7 * * * uci set wireless.wifinet3.disabled=0; uci commit; wifi

@mikko70
Copy link
Author

mikko70 commented Jul 14, 2021

But it not need be empty, i say every time.

@professor-jonny
Copy link

So you want the wording to be updated if it is not empty and running it will say somthing else ?

@mikko70
Copy link
Author

mikko70 commented Jul 15, 2021

Yes, restarting not need do once, it need do evert time.
Not problem, but if information tell it, it´s wrong. Not good user experience, user need do anything else than information tell. Always easier using is better. Not sure if it is one model problem or common problem by cron change.

schenduleinfo

Reproduce problem.

Step 1.
Put in shedule

00 10 * * * /sbin/wifi down
02 10 * * * /sbin/wifi up; wifi

/etc/init.d/cron restart
It working, wifi go on 10am 00 and off 10am 02

Step2.
Put in shedule

05 10 * * * /sbin/wifi down
07 10 * * * /sbin/wifi up; wifi

It not working, wifi state not change timed.

Step3.
Put in shedule

10 10 * * * /sbin/wifi down
12 10 * * * /sbin/wifi up; wifi

/etc/init.d/cron restart
It working, wifi go on 10am 10 and off 10am 12

Step4.
Put in shedule

14 10 * * * /sbin/wifi down
16 10 * * * /sbin/wifi up; wifi

/etc/init.d/cron restart
It working, wifi go on 10am 14 and off 10am 16

Step5.
Put in shedule

16 10 * * * /sbin/wifi down
18 10 * * * /sbin/wifi up; wifi

/etc/init.d/cron restart
It working, wifi go on 10am 16 and off 10am 18

Step6.
Put in shedule

20 10 * * * /sbin/wifi down
22 10 * * * /sbin/wifi up; wifi

It not working, wifi state not change timed.

@professor-jonny
Copy link

professor-jonny commented Jul 15, 2021

That wont work if devices are associated with the connection at the time of shutdown you are using the wrong command.

Instead use below like I said above and it will force off the wifi interface even if clients are connected
but you will need to customise your wifi name by using the command uci show wireless

This is my wirless config and I want to turn off the kids5g interface so I use wireless.wifinet 2 interface

wireless.radio0=wifi-device
wireless.default_radio0.ssid='Admin2.5g'
wireless.default_radio1.ssid='Admin5g'
wireless.wifinet2=wifi-iface
wireless.wifinet2.device='radio1'
wireless.wifinet2.ssid='Kids5g'
wireless.wifinet2.network='KidsLan'
wireless.wifinet3.device='radio0'
wireless.wifinet3.ssid='Kids2.5g'
wireless.wifinet3.network='KidsLan'

The below pasting in my interface name it will turn off at 11pm and 11:10 pm:
and turn back on at 7 and 7:10 am

The reason i have pasted in 0 and 10 minutes if for some reason the kids get smart and turn off the router at 11pm it will miss the cron job and it will then work again 10 minutes later to fool the kids :-)

0/10 23 * * * uci set wireless.wifinet2.disabled=1; uci commit; wifi
0/10 7 * * * uci set wireless.wifinet2.disabled=0; uci commit; wifi

But to be honest it is probally better to put up a firewall rule to just block outbound traffic to WAN it will effectivly do the same thing.

@jow-
Copy link
Contributor

jow- commented Jul 15, 2021

Don‘t add leading zeroes to your time specs. Also not LuCi related.

@jow- jow- closed this as completed Jul 15, 2021
@jow- jow- reopened this Jul 15, 2021
@professor-jonny
Copy link

professor-jonny commented Jul 15, 2021

I agree this is not luci related but he does I think make a point that the note does not change if the service is running.
Can luci interface include a command to start the cron service on pressing save or maybe something to start or show the status of cron?

@jow- jow- closed this as completed in 8d4ac60 Jul 15, 2021
jow- added a commit that referenced this issue Jul 15, 2021
Fixes: #5184
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 8d4ac60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants