run commands on boot/loading modules

Roland Smith rsmith at xs4all.nl
Thu Dec 15 13:56:24 PST 2005


On Thu, Dec 15, 2005 at 02:13:01PM -0700, TuxGirl wrote:
> Hi,
> 
> There are 3 commands I was having to run each time that I started up
> my computer, and I'm trying to figure out the correct way to have them
> run automatically.
> 
> kldload if_iwi
> iwicontrol -i iwi- -d /usr/local/share/iwi-firmware -m bss
> kldload snd_ich

To load the modules, put the following in /boot/loader.conf

if_iwi_load="YES"
snd_ich_load="YES"


> So, I'm guessing that /etc/rc.conf isn't the right place to add these
> 3 lines.  

Yes. :-) Every rc script sources rc.conf, so your commands are all
executed dozens of times. rc.conf is only for setting variables.

> I just want the commands to run once during the boot, and
> probably sometime near the end of boot so that I don't have to worry
> about them depending on something that's done earlier on (at least for
> the wireless stuff).

If you have a single iwi device, it will be named iwi0, I think.

From looking at /etc/rc.d/netif, you'll see that it executes a shell
function ifscript_up for every interface. You can find ifscript_up in
/etc/network.subr. Looking at it, you can see that you should create a
script /etc/start_if.iwi0, with the iwicontrol command in it.

HTH,

Roland
-- 
R.F.Smith (http://www.xs4all.nl/~rsmith/) Please send e-mail as plain text.
public key: http://www.xs4all.nl/~rsmith/pubkey.txt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20051215/42f0ed18/attachment.bin


More information about the freebsd-questions mailing list