"Network is unreachable" error for bash script at startup
I have a bash script that is run at startup on an Odroid running Ubuntu Mate. The script connects to the wifi and then calls a python script which makes a http request:
...
nmcli dev connect NETWORKNAME password PASSWD
python my_script.py
...This script works when I call it after boot. However, when it is called during boot, the "Network is unreachable" error is thrown. I tried to use the ethernet connection but the result is the same. Also, adding a sleep 30 command before calling the python script doesn't work. How can I solve this problem?