Rasbian on a Rasberry PI zero.
I have disabled the networking and dhcpcd services from startup and want to start networking and get an IP from within my own script, which is initiated from a custom systemd service.
This is the part of the script that is puzzling me:
wpa_passphrase ssid password > /etc/wpa_supplicant/wpa_supplicant.conf systemctl start networking.service dhcpcd wlan0
Running dhcpcd wlan0 from within the script will not assign an IP (ifconfig after login), but running sudo dhcpcd wlan0 will get me an IP if I run it after startup and login. Anyone know if this is a timing issue (wait for networking.service) or if I need to do something differently to get an IP via dhcpcd within the script.
I have also tried adding some delay (sleep 100) and running systemctl start dhcpcd (instead of dhcpcd wlan0).
I know this is not the standard way of doing this, but disabling networking and dhcpcd and start it from within my script will make startup more efficient (less up/down and waiting for network before doing more initiation etc.). I do a lot of custom configuration and instantiation from within my script.