[SOLVED]CAN'T excute rc.local when boot.

This forum is for topics specific to the Raspberry Pi and Arch Linux ARM

[SOLVED]CAN'T excute rc.local when boot.

Postby NomadThanatos » Fri Sep 21, 2012 6:04 pm

$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. :cry:

$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..
Last edited by NomadThanatos on Sun Sep 23, 2012 5:10 pm, edited 1 time in total.
NomadThanatos
 
Posts: 2
Joined: Fri Sep 21, 2012 5:53 pm

Re: CAN'T excute rc.local when boot.

Postby Huulivoide » Fri Sep 21, 2012 6:24 pm

Huulivoide
 
Posts: 27
Joined: Tue Jun 26, 2012 6:22 pm

Re: CAN'T excute rc.local when boot.

Postby WarheadsSE » Fri Sep 21, 2012 7:21 pm

And use the appropriate systemd stuff, if you have moved to that.
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: CAN'T excute rc.local when boot.

Postby NomadThanatos » Sun Sep 23, 2012 5:06 pm

Thanks a lot,I use systemd to solve this.It works fine now.

First I edit this file

/etc/modules-load.d/8192cu.conf

$this->bbcode_second_pass_code('', '
#Load 8193cu chipest drivers at boot
8192cu
')

Then

/etc/wifi

$this->bbcode_second_pass_code('', '
#!/bin/bash

if test $1 = "--start"
then
ifconfig wlan0 up
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
dhcpcd wlan0
elif test $1 = "--stop"
then
dhcpcd wlan0 --exit
fi
exit 0
')

$this->bbcode_second_pass_code('', '
chmod a+x /etc/wifi
')

Finally

/lib/systemd/system/wifi.service

$this->bbcode_second_pass_code('', '
[Unit]
Description=Wifi Service
ConditionPathExist=/etc/wifi

[Service]
Type=forking
ExecStart=/etc/wifi --start
ExecStop=/etc/wifi --stop

[Install]
WantedBy=multi-user.target
')
NomadThanatos
 
Posts: 2
Joined: Fri Sep 21, 2012 5:53 pm

Re: [SOLVED]CAN'T excute rc.local when boot.

Postby WarheadsSE » Sun Sep 23, 2012 9:43 pm

Psst - net-auto-wireless
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 5 guests