View Full Version : Startup Script to Activate WLAN Adapter
easethan
9th June 2005, 08:06 PM
For some reason trying to activate my adapter(D-Link DWL-G510 Rev B.) through the network settings app freezes the kernel, a known problem with this adapter. I'm asuming that 'ifup ath0' is the same command that the network settings uses as this freezes it too.
I did find out how to activate the adapter from someone who has the same card, but it requires root to perform some of the actions, so I can't put it in ifcfg-ath0(or can I somehow?). Could you help me figure out how to perform the below commands at startup, using the root user?
modprobe ath_pci
ifconfig ath0 down
ifconfig ath0 up
iwconfig ath0 channel 6 essid "My Network" key "FFFFFFFFFFFFFFFF" (possibly not required)
dhclient ath0
I'm a new linux user and there are some software limitations that are already starting to deter me. If I can't get this to run at startup I probably won't stick with linux, and I want to! :confused:
bytesniper
9th June 2005, 08:08 PM
put those commands at the end of this file:
/etc/rc.local
easethan
9th June 2005, 09:06 PM
Thanks bytesniper this worked great!
I have another question though. I would like to use the time-sync option, but the rc.local file doesn't run until after the computer tries to sync the clock. Is there a way I can run this script before the time sync occurs?
Could this possibly be done by changing the order of things in rc.d? I thought this might be possible through this file considering the similar file name and the fact that it appears that rc.d actually calls rc.local...but I could be completely wrong as it could just be a log file(considering the dates).
Thanks!
easethan
9th June 2005, 09:45 PM
Whew! I did it!
I opened up rc.d and discovered that if you hit enter on any of the lines it sends you to a config file for the corrosponding procedure...or whatever, not sure of all the terminology yet.
So I got to the network one, figured out how to use the 'action' command and added my stuff to the file. Works perfectly! I still don't know how to make all of my actions run using just one 'action' command, so when you startup I made it show something like:
Bringing up ath0 - modeprobe: [OK]
Bringing up ath0 - down: [OK]
Bringing up ath0 - up: [OK]
Bringing up ath0 - config: [OK]
Bringing up ath0 - dhclient: [OK]
Corrosponding to
modprobe ath_pci
ifconfig ath0 down
ifconfig ath0 up
iwconfig ath0 channel 6 essid "My Network" key "FFFFFFFFFFFFFFFF" (possibly not required)
dhclient ath0
But it works so I can't complain too much.
NOTE TO ALL: If you don't have above average programming skills do not try this! PHP skills are most likely sufficient to figure it out.
Thanks so much for your help bytesniper!!!
bytesniper
9th June 2005, 09:50 PM
you can insert it into any part of the boot process you want to, depending on how much effort you want to put into it. what is loaded up in the boot process and in what order is controlled by the /etc/rc1.d through /etc/rc5.d (rc6.d is shutdown stuff in case you were wondering). everything in rc1.d-rc6.d are symlinks to what is in /etc/init.d. so it works like this: i want something to boot up in runlevel 3 and 5. i make an init script and put it into /etc/init.d and then go into /etc/rc3.d and /etc/rc5.d and provide symlinks to ../init.d/scriptname. when 'init 3' is called in the boot process every symlink in rc3.d is executed, therefore starting your daemons. same for the other runlevels. so, make a script that starts what you want it to start and put it in init.d. (see note1 at this point) and then symlink it from rc#.d where you want it to start. the S## and K## on the symlinks is ther to determine their boot order within the runlevel.
chkconfig can automatically manage what runlevel your script starts as and then you can manage it as a service. man chkconfig for more info on it.
hope this helps!
bytesniper
9th June 2005, 09:52 PM
ah... ignore that last post then! good job :)
sorry.. i have a habit of making things harder than they need to be :D
easethan
9th June 2005, 09:54 PM
Oh thanks for that info bytesniper! I just put my stuff in the network area of init.d. Later I'll make it in it's own area as per your suggestion. Although I figured out the jist of it on my own thanks for the info you provided!
lol I was sitting there the whole time I was editing, afraid I was completely screwing up my computer because I had no idea what I was doing!
Thanks again bytesniper! You've been a lot of help!
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.