Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
can someone tell me how to create a script?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jjc53
n00b
n00b


Joined: 15 Apr 2004
Posts: 13

PostPosted: Mon Apr 26, 2004 3:44 am    Post subject: can someone tell me how to create a script? Reply with quote

My ethernet card is really finicky. The only way I can get it to work is to force the link speed to half duplex using
Code:
mii-tool etho -F 10BaseT-HD
/etc/init.d/net.eth0 restart


However, once I reboot, that setting is lost, and then I had to wait for the bringing eth0 up to timeout at boot. Right now, my fix is I removed the net.eth0 from the runlevels, and manually type the code (only as root) above when i need network access.

Is there anyway I can create a script with these two commands that I can insert in the runlevels at boot time? I hope this isn't a stupid question, but I am new to unix. I just finished compiling gentoo-dev-sources 2.6.5 kernel. If there is a way, can you explain how to do it.

Thanks in advance
Back to top
View user's profile Send private message
teknomage1
Veteran
Veteran


Joined: 05 Aug 2003
Posts: 1239
Location: Los Angeles, CA

PostPosted: Mon Apr 26, 2004 4:06 am    Post subject: Reply with quote

Save this snippet as /etc/init.d/eth0tweak
Code:
#!/sbin/runscript

depend() {
    provide eth0tweak
}

start() {
    mii-tool etho -F 10BaseT-HD
    }

Don't forget to do 'chmod + x /etc/init.d/eth0tweak' and edit the depend portion of /etc/init.d/net.eth0 to look like this
Code:
depend() {
    need eth0tweak
    use hotplug pcmcia
}

and execute 'rc-update add eth0tweak default' and it should work. What this is doing is telling the init system to run the mii-tool command before it's allowed to bring up eth0.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20588

PostPosted: Mon Apr 26, 2004 4:42 am    Post subject: Reply with quote

Moved from Installing Gentoo.
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
jjc53
n00b
n00b


Joined: 15 Apr 2004
Posts: 13

PostPosted: Mon Apr 26, 2004 3:20 pm    Post subject: Reply with quote

thank you for this code. what is the purpose of the hotplug pcmcia line? i do not think i have pcmcia support becuase i have no pcmcia cards. will that effect any of the code?

thanks
Back to top
View user's profile Send private message
ynef
n00b
n00b


Joined: 14 Jan 2004
Posts: 69
Location: Lund, Sweden

PostPosted: Mon Apr 26, 2004 5:47 pm    Post subject: Reply with quote

jjc53 wrote:
thank you for this code. what is the purpose of the hotplug pcmcia line? i do not think i have pcmcia support becuase i have no pcmcia cards. will that effect any of the code?

thanks

What he means is that you should add the line that says "need eth0tweak" to the depend() portion of net.eth0

Cheers!
Back to top
View user's profile Send private message
jjc53
n00b
n00b


Joined: 15 Apr 2004
Posts: 13

PostPosted: Mon Apr 26, 2004 6:07 pm    Post subject: Reply with quote

Ok, I see now. I thought that he was talking about the same depend function. So that hotplug pcmcia is already in the net.eth0 depend function.

Thanks a lot both of you...that's a big help
:D
Back to top
View user's profile Send private message
jjc53
n00b
n00b


Joined: 15 Apr 2004
Posts: 13

PostPosted: Mon Apr 26, 2004 8:59 pm    Post subject: Reply with quote

I tried what you said and it worked. Thanks again.

However when I ran rc-update it said:
Code:
Cannot add provide 'eth0tweak', as a service with the same name exis


It doesn't seem to affect anything, but do you know what that means?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum