Reacquire WIFI connection after reset of router

I reset my WIFI router every night around 02:00.
When it returns to operation, occasionally, OSMC (RPi3) does not reacquire its wifi connection.

To solve this I now force the wifi to restart by this cron job:
sudo ifdown wlan0; sleep 10; sudo ifup wlan0

However, after that the /etc/resolv.conf file becomes empty causing all matter of other problems.

Please either enlighten me how to “reset” the /etc/resolv.conf without rebooting or suggest a better solution to restart the wifi connection.
Thank you.

I was talking to Sam about this the other day and he told me that the ifupdown package should not be used on OSMC, so I guess you’ve found one of the side-effects.

Perhaps something along the lines of:

connmanctl disconnect wifi_<something>_managed_psk
connmanctl connect wifi_<something>_managed_psk

might have a better chance of working.

I gave your suggestion a try and it seems to work.


Will test this for a couple of days to see if it continues to work.