$this->bbcode_second_pass_code('', '#!/bin/bash
sleep 1
modprobe 8192cu
sleep 1
ifconfig wlan0 up
sleep 1
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
sleep 1
dhcpcd wlan0
exit 0
')
I write above code in my /etc/rc.local
But this script wont be excuted when my PI boot & reboot.
I can run this script after I login.
$this->bbcode_second_pass_code('', '[root@alarmpi ~]# /etc/rc.local
ioctl[SIOCSIWAP]: Operation not permitted
dhcpcd[164]: version 5.6.2 starting
dhcpcd[164]: wlan0: sending IPv6 Router Solicitation
dhcpcd[164]: wlan0: sendmsg: Cannot assign requested address
dhcpcd[164]: wlan0: rebinding lease of 192.168.1.250
dhcpcd[164]: wlan0: carrier lost
dhcpcd[164]: wlan0: carrier acquired
dhcpcd[164]: wlan0: sending IPv6 Router Solicitation
dhcpcd[164]: wlan0: rebinding lease of 192.168.1.250
dhcpcd[164]: wlan0: acknowledged 192.168.1.250 from 192.168.1.1
dhcpcd[164]: wlan0: checking for 192.168.1.250
dhcpcd[164]: wlan0: sending IPv6 Router Solicitation
dhcpcd[164]: wlan0: leased 192.168.1.250 for 86400 seconds
dhcpcd[164]: forked to background, child pid 230
')
I just want auto start my wifi.
I have read some articles,it seems that using rc.local is the best way but I fail..