Go Back   The macosxhints Forums > OS X Help Requests > UNIX - Newcomers



Reply
 
Thread Tools Rate Thread Display Modes
Old 01-20-2004, 07:45 AM   #1
Sujeto
Prospect
 
Join Date: Jan 2004
Posts: 6
Question How to create a MTU folder in Library

By mistake I erased the MTU folder in Library (G4 Mac OS 10.2.8), I would like to change the value to 1364, so I imagine that I have to create a new MTU folder in order to change it but I don´t have any experience working with UNIX systems. Can somebody assist me?
__________________
Sujeto
Sujeto is offline   Reply With Quote
Old 01-21-2004, 03:13 AM   #2
gatorparrots
Major Leaguer
 
Join Date: Dec 2002
Posts: 441
I assume you mean /Library/StartupItems/MTU?

Apple's technote does a fair job of explaining how to create such a StartupItem:
http://docs.info.apple.com/article.html?artnum=107474
gatorparrots is offline   Reply With Quote
Old 01-21-2004, 08:32 PM   #3
Sujeto
Prospect
 
Join Date: Jan 2004
Posts: 6
Not in Startup Items

Thank you for the tip, but I had TWO MTU folders after following those indications, one in the Library folder (I think this was already there before) and the other (The new one) that I created in Library/ Startup Items. I erased the first one, if I follow the indications again (I did it twice) the MTU folder/ Library don't come back, so I ask again: Is this folder important?, How can I replace it?
__________________
Sujeto
Sujeto is offline   Reply With Quote
Old 01-22-2004, 01:16 AM   #4
gatorparrots
Major Leaguer
 
Join Date: Dec 2002
Posts: 441
A directory /Library/MTU should be meaningless, unless it is for a specific purpose to support some third-party application. If your goal is to set your MTU at boot time, /Library/StartupItems/MTU is what you are after.
gatorparrots is offline   Reply With Quote
Old 01-22-2004, 10:54 AM   #5
Sujeto
Prospect
 
Join Date: Jan 2004
Posts: 6
Question

Now: I followed the instructions in the link to Mac support that you gave me, everything was there as expected, thanks. My first question: Is there a way to check that the MTU is set to the value I gave it?

Then, in the last part of the post is written:
"1. The MTU will be reset after changing a Location, waking the computer from sleep, or changing the state of the network interface. To use the script again without having to restart, enter the following command:
sudo SystemStarter start MTU"

My second question is: How I use it: After opening the Terminal app. (Welcome to Darwin!
[Computer:~] User%) or I have to go to: ([Computer:/Library/StartupItems/MTU] User%)?
Because I get a message:
"Welcome to Macintosh.
Configuring network
Unable to load localization strings for /Library/StartupItems/MTU
Configuring MTU
Startup complete.
Hangup"
Is this Ok?, There is a way to set the MTU value permanently?
Sorry if I make it complicated, I'm just trying to understand.
Thank you again.
__________________
Sujeto
Sujeto is offline   Reply With Quote
Old 01-22-2004, 05:09 PM   #6
stetner
MVP
 
Join Date: Jan 2002
Location: Brisbane, Australia
Posts: 1,108
To see your mtu:
Code:
$ ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1454
...
...
where en0 is your network interface (use 'ifconfig -a' to see all interfaces.)

As for a startup item, I would duplicate one of the existing ones in /Library/StartupItems (or duplicate one from /System/Library/StartupItems to /Library/StartupItems) renaming the directory and the script inside it as appropriate, and then edit the script to pull out whatever it did and replace it with what you want to do.

If that is too daunting, reply back and I will give you a step by step on how to do it by hand (when I find the time...).

Once it is in there and running, you do not need to do anything for it to work. When the system boots, it will get run, you do not need to do it manually.
__________________
Douglas G. Stetner
UNIX Live Free Or Die
stetner is offline   Reply With Quote
Old 01-22-2004, 06:33 PM   #7
Sujeto
Prospect
 
Join Date: Jan 2004
Posts: 6
Sorry Mr. Stetner, I tried but I could not make it work, I´ll appreciate if you can help me step by step, I´m not hurried, so take your time, everything is working for the moment.
Thank you very much.
__________________
Sujeto
Sujeto is offline   Reply With Quote
Old 01-22-2004, 07:25 PM   #8
stetner
MVP
 
Join Date: Jan 2002
Location: Brisbane, Australia
Posts: 1,108
Ok, if you copy and paste the following into a terminal window, EXACTLY as it appears below, you should get a working MTU change at startup. You will be prompted for your password after the first command (sudo). and after that the commands will be run as root, so it is very important to copy and paste it exactly as it is below.

I have looked at gatorparrots link in the second post and it really does describe exactly how to do the same thing as this. You might want to re-read that and give it a try first, because if you screw up the copy and paste below you may mess things up.

That said, it really is quite straight forward. It gain privileges then makes a directory, then dumps the text into the /Library/StartupItems/MTU/MTU file, does the same for the /Library/StartupItems/MTU/StartupParameters.plist file and then set permissions. It then adds the MTU flag to the /etc/hostconfig file.

You will then need to restart to see it get picked up.

It allso assumes you are running on the ethernet interface 'en0' and that you want your mtu to be 1364.

Code:
sudo -s
mkdir -p  /Library/StartupItems/MTU
cat >/Library/StartupItems/MTU/MTU <<EOF
#! /bin/sh

. /etc/rc.common

StartService ()
{
        if [ "\${MTU:=-NO-}" = "-YES-" ]
        then 
            ConsoleMessage "Network Tuning" 
            /sbin/ifconfig en0 mtu 1364
            ConsoleMessage -S
        fi
}

StopService ()
{
        return 0
}

RestartService ()
{
        return 0
}

RunService "\$1"

EOF

cat  >/Library/StartupItems/MTU/StartupParameters.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">
<dict>
        <key>Description</key>
        <string>MTU</string>
        <key>Messages</key>
        <dict>
                <key>start</key>
                <string>Starting MTU</string>
                <key>stop</key>
                <string>Stopping MTU</string>
        </dict>
        <key>OrderPreference</key>
        <string>Late</string>
        <key>Provides</key>
        <array>
                <string>MTU</string>
        </array>
        <key>Requires</key>
        <array>
                <string>Network Configuration</string>
        </array>
</dict>
</plist>

EOF

chown root /Library/StartupItems/MTU/MTU
chown root /Library/StartupItems/MTU/StartupParameters.plist
chgrp admin /Library/StartupItems/MTU/MTU
chgrp admin /Library/StartupItems/MTU/StartupParameters.plist
chmod 755  /Library/StartupItems/MTU/MTU
chmod 644  /Library/StartupItems/MTU/StartupParameters.plist

echo "MTU=-YES-" >>/etc/hostconfig
exit
__________________
Douglas G. Stetner
UNIX Live Free Or Die
stetner is offline   Reply With Quote
Old 01-23-2004, 01:54 AM   #9
gatorparrots
Major Leaguer
 
Join Date: Dec 2002
Posts: 441
Quote:
Originally posted by stetner
Code:
chown root /Library/StartupItems/MTU/MTU
chown root /Library/StartupItems/MTU/StartupParameters.plist
chgrp admin /Library/StartupItems/MTU/MTU
chgrp admin /Library/StartupItems/MTU/StartupParameters.plist

These four lines can be accomplished in a single command:
chown -R root:admin /Library/StartupItems/MTU
gatorparrots is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 07:33 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.