i want to start a bash script in ubuntu after boot. But the script should run first after wlan0 device is connected to my wifi.
How can i achieve this?
I'd start it at boot and let it wait until wlan0 is connected. You can check this via
#!/bin/bash while true; do # testing... LC_ALL=C nmcli -t -f DEVICE,STATE dev | grep -q "^wlan0:connected$" if [ $? -eq 0 ]; then break else # not connected, sleeping for a second sleep 1 fi done # now connected, run the script