The macosxhints Forums

The macosxhints Forums (http://hintsforums.macworld.com/index.php)
-   UNIX - General (http://hintsforums.macworld.com/forumdisplay.php?f=16)
-   -   Making Unix Command Stick (http://hintsforums.macworld.com/showthread.php?t=8767)

tsugaru 01-21-2003 04:02 PM

Making Unix Command Stick
 
After looking around in my Power Mac manual, the manual states that when auto-detecting network connection speeds, it defaults to half-duplex. My cable provider does not have auto-detecting switches/hubs, but ensured me that their service is full-duplex, not just half. I have tried using full-duplex, on both my Athlon and Quicksilver, and there is indeed full-duplex. No collisions at all.

So, I would like to enable full duplex throughput on my Mac, thereby increasing my transfer speeds (it seems whenever I am transferring one way [up or down] if I try to start another transfer the other way, it never gets past 4K/s.)

I already know now to set full duplex on my machine.

# sudo ifconfig en0 media 10baseT/UTP mediaopt full-duplex

However, I am not one who enjoys entering this long string in every time I start up in OS X. How do I make the system execute this command upon startup, and without having to pause my system to enter in an administration password?

Thank you.

sbur 01-21-2003 04:08 PM

One of the experts will have to tell you exactly which startup-file to put the command in, but you can edit one of them to add this to the start-up routine. I think /etc/rc is the file you want, but wait for a second opinion before you change it. Also, when you change it, make a copy call "old.rc" or something so you have an original should problems arise.

macubergeek 01-21-2003 05:09 PM

you could try this...
 
vi /Library/StartupItems/fullDuplex


in that file put your line:

sudo ifconfig en0 media 10baseT/UTP mediaopt full-duplex

chown root /Library/StartupItems/fullDuplex
chgrp wheel /Library/StartupItems/fullDuplex
chmod 700 /Library/StartupItems/fullDuplex

reboot your computer

once rebooted test with:
ifconfig -a

rusto 01-21-2003 10:32 PM

NOTE: Just to be clear, after you enter your line,

Code:

sudo ifconfig en0 media 10baseT/UTP mediaopt full-duplex
in the vi editor, you should save & exit the editor (return to the command line) and THEN enter the 3 commands,

Code:

chown root /Library/StartupItems/fullDuplex
 chgrp wheel /Library/StartupItems/fullDuplex
 chmod 700 /Library/StartupItems/fullDuplex


tsugaru 01-21-2003 10:59 PM

vi?
 
Can I do this in pico by any chance? I don't like vi.

Quote:
vi /Library/StartupItems/fullDuplex

I assume this makes a fullDuplex file in the StartupItems folder, not a folder?

rusto 01-21-2003 11:39 PM

Yes, pico is OK and yes, it makes a file.

Code:

pico /Library/StartupItems/fullDuplex

eravau 01-21-2003 11:45 PM

How dare you tell someone that pico is Ok compared to vi. ;)

tsugaru 01-22-2003 10:11 AM

vi is for the true uber-geek nerdy type people (he he he :D )

I like pico. Nice and simple.

tsugaru 01-22-2003 10:27 AM

None of the hints above worked.

I am currently going into my BroadbandOptimizer file and editing that. Perhaps that will work it.

Also, editing my BroadbandOptimizer file and seeing the results in ifconfig -a, I show this. (This is somewhat promising, yet disheartening.)

Code:

[localhost:~] avu% ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        inet6 ::1 prefixlen 128
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
        inet 127.0.0.1 netmask 0xff000000
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        inet6 fe80::203:93ff:fea8:e848%en0 prefixlen 64 scopeid 0x4
        inet 24.86.188.228 netmask 0xffffff00 broadcast 24.86.188.255
        ether 00:03:93:a8:e8:48
        media: 10baseT/UTP <full-duplex> (10baseT/UTP <half-duplex>) status: active
        supported media: none autoselect 10baseT/UTP <half-duplex> 10baseT/UTP <half-duplex,hw-loopback> 10baseT/UTP <full-duplex> 10baseT/UTP <full-duplex,hw-loopback> 100baseTX <half-duplex> 100baseTX <half-duplex,hw-loopback> 100baseTX <full-duplex> 100baseTX <full-duplex,hw-loopback> 1000baseTX <full-duplex> 1000baseTX <full-duplex,hw-loopback> 1000baseTX <full-duplex,flow-control> 1000baseTX <full-duplex,flow-control,hw-loopback>
[localhost:~] avu%

Why in the media area above supported media show full and half-duplex? WTF did I do?

tsugaru 01-22-2003 04:15 PM

^^

stetner 01-22-2003 07:52 PM

Code:

% ifconfig -a
...
...
en0:
        media: autoselect (100baseTX <full-duplex>) status: active

So it appears that the first bit is what it is set to try, and the bit in brackets is what you actually got. IE mine is set to autoselect and it selected 100 full.

Yours is set to try 10 full but is falling back to 10 half.

At least that is my take on it 8-)

Titanium Man 01-22-2003 10:39 PM

Creating a startup item (a command that will execute when the machine is booted) is a little more involved than discussed above. Here's how it's done:

http://www.opensource.apple.com/proj...ter_HOWTO.html


Or you could just paste this:

#! /bin/sh

sudo ifconfig en0 media 10baseT/UTP mediaopt full-duplex

in an an executable file that ends in ".command" as in "testscript.command" and then drop that file into your Login Items in the system prefs. It will launch a Terminal window when you log in, and you'll be prompted for your password, but that might be easier than creating a startup item.

tsugaru 01-22-2003 11:33 PM

That's the thing. I don't want a terminal window popping up. I just want my system to automatically read the entry I made in BroadbandOptimizer and set my network to 10baseT/UTP full-duplex.

But I'm happy. The Oilers beat the Red Wings 4-3 tonight. Wheee!

sbur 01-23-2003 07:48 AM

Quote:

Originally posted by tsugaru
But I'm happy. The Oilers beat the Red Wings 4-3 tonight. Wheee!
Crap. :(

tsugaru 01-23-2003 03:31 PM

Plays "Zombie Nation" (the Oilers goal song)...

Boo yah... 2-0-1 against the mighty Red Wings this year. Oh yeah.

BTW, how do I make full-duplex stick?

sbur 01-23-2003 03:47 PM

Quote:

Originally posted by tsugaru
Plays "Zombie Nation" (the Oilers goal song)...

Boo yah... 2-0-1 against the mighty Red Wings this year. Oh yeah.

BTW, how do I make full-duplex stick?
When I had something that needed to happen at the system level on an SGI running Irix, I put it in one of the rc script found in /etc.

For example, when I needed to make sure a license server (for macromodel or sybil, whatever) would automatically start up and was available for all users on the machine, I would find the "rc" script that was last to run on (re)boot, and insert the appropriate shell command near the end.

I haven't had to do this on the OS X box yet, but I know there is at least one rc script that runs at boot time.

The advantage to doing it this way is that it happens on reboot and is sytem wide...the users don't need to worry about anything, and you don't have to call a script each time you log in. You also don't have permission problems because root executes the command.

The disadvantage is that you are messing with the boot process so it can be intimidating (and potentially frustrating to trouble shoot). Look at the file /etc/rc and see if it looks like you can insert it near the end. Again, I will say that you should make a copy of the original rc script in case you need to replace it.

Merv, if you read this, let me know if I'm being a moron here. Darwin, with little exception, is not Irix ... so the details may be wrong here. I suspect they are not, though.


PS: An Oilers fan I can live with. If you were a Stars fan or an Avalanch fan we might have some problems. :) I don't like the Islanders either but that is more because of an obnoxious room-mate my freshman year at college. I should probably get over that. :D

mervTormel 01-23-2003 03:53 PM

Quote:

Originally posted by sbur
...Merv, if you read this, let me know if I'm being a moron here...
that technique is fine, but you have to manage it.

i think the broadband optimizer approach is better; same results and less to manage on OS upgrades.

tsugaru 01-23-2003 07:33 PM

But the BBOptimizer approach doesn't work either.

I don't really wanna fudge with the rc thing (sounds deadly).

BTW, being an Oilers fan, you know how much I hate the Stars. Eugh...

I grew up on Gretzky, Kurri, Messier, Semenko, Moog, Fuhr, Linesman, Coffey, Lowe, MacTavish and Craig Simpson. I couldn't name another team as dominating as the Edmonton Oilers of the 80s.

stetner 01-23-2003 10:29 PM

The OS X way is via StartupItems. Take a look in /Library/StartupItems/ and see if there are any items there that you can use as an example. This link also gives an example:
http://www.greasydaemon.com/macosx/macfirewall/
or just search here for 'StartupItems' and you should get a bunch of hits.

sbur 01-24-2003 07:58 AM

Quote:

Originally posted by tsugaru
But the BBOptimizer approach doesn't work either.

I don't really wanna fudge with the rc thing (sounds deadly).
Not really deadly. Just not "straight foward." Someone like Merv can probably tell you where to put it. He's right, though, that this can be a problem...every time you upgrade, you need to check to make sure they the rc script didn't get replaced. Working on the SGI's, this was not a problem...we upgraded once every few years, not twice a year.

/Library/Startup seems like an interesting way to do the same thing.

BTW, I was living in Austin when the Stars won the cup. Dang I hated having to listen to the people, who thought they knew hockey, go on about their goons in Dallas. Now I'm in Atlanta with the Thrashers. 'Nuff said. Thank God I'm moving to MN this summer!

tsugaru 01-24-2003 12:56 PM

I like Atlanta solely on the fact of Bob Hartley and Dany Heatley. But they need some more decent people other than Heatley and Kovalchuk.

BTW, I don't really like Kovalchuk, as don't most of the other players in the league. He is cocky. Whenever he scores, he takes the ice off of his gloves and leaves it near the opposing bench. That's why I was happy when Comrie fought him. Little punk, I say.

So how do I install the sudo ifconfig en0 media 10baseT/UTP mediaopt full-duplex thing again?!?


All times are GMT -5. The time now is 05:36 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.