Turning wifi on with every (re)boot

I want to use a cronjob, which disables root in the night and starts it in the afternoon. Since it is a bridge without a cable, it is not so easy to switch wifi on. So I think, it could be a solution that wifi starts with every boot.

I created a script that wifi will be enabled:

cat /root/wifi_on.sh

uci set wireless.radio0.disabled=0
uci set wireless.radio1.disabled=0
uci commit wireless

Is there a better solution than to put it in /etc/rc.local ?

It is unnecessary to disable a wifi device and commit that disable value to the config file to turn off the wifi. wifi down will turn the wifi off without any change to your config. If you leave wifi enabled in your config, it will come on upon boot.

Also, no offense, but this is now the what, 3rd thread you are opening regarding your "I don't want to have wifi on at night" problem?

Sorry, I thought this is a specific question. In the meantime I found out, that I have a network problem. My clients connect very well via the routers to the internet, but when I connect via ssh to a router I don't get a network connection. (thread already opened). So my cronjobs use a wrong time, because ntp doesn't work and I thought they don't work because of the cron-configuration.

I understand, that the router will start with the last state, but this is not what I want, The router should enable wifi everytime,

With regards to your earlier threads and this one -- there is really no reason to turn off wifi at night (from a health perspective with respect to the wifi radiation). There is zero proof of any negative health impact from low power, non-ionizing radiation such as found in consumer electronics and such (there is also a lot of scientific evidence debunking electromagnetic hypersensitivity).

That said, if you really want to turn it off, you could use cron jobs and such, but maybe the easiest thing to do is just get one of these.

Not necessarily. Two of the commands you use (set disabled, commit) permanently commit the last state to the configuration. That is entirely unnecessary to turn off the wifi. A simple "wifi down" will shut the wifi down and not commit that state to configuration.

I.e., you can turn off and on the wifi using "wifi down" and "wifi up", and leave the configuration as it is. This way the router, when booted, will do what the configuration says, not what the last state of your toggling was.

1 Like

I found out, that my cronjobs didn't work because the time was not correct and this is because, my routers itself have no internet connections, although the clients have an internet connection. There is something wrong with the dns-configuration. I have to solve No internet connection from the router via ssh from time to time first, maybe you have an idea.

In short the clients work, because DNS is configured directly in the client, but the routers need DHCP off, but DNS working and if I set a gateway to the gateway-router, it works, but then I cannot reach the other openwrt router.