Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Take care whether the network is up or not!' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Take care whether the network is up or not!
Authored by: Thomas Kaiser on Mar 28, '03 11:42:09AM
You should take care whether the network is up or not.
So it might be a better idea to use something like
#!/bin/sh

##
# Configure network interfaces and host name
##

. /etc/rc.common

StartService ()
{
    ConsoleMessage "Setting en0 to 100BaseT"

    # See if the network is up now
    CheckForNetwork

    ##
    # Configure global network settings
    ##

    if [ "${NETWORKUP:=-NO-}" = "-YES-" ]; then
    
        /sbin/ifconfig en0 media 100baseTX mediaopt full-duplex

    fi
}

StopService ()
{
    return 0
}

RestartService ()
{
    return 0
}

RunService "$1"

In addition your StartupParameters.plist can be written much
shorter.
You should also use a "Requires" statement because this has
precedence regarding the start order.
{
  Description     = "sets the interface to 100BaseT full duplex";
  Provides        = ("FullDuplex");
  Requires        = ("Network");
  OrderPreference = "First";
}
Regards,

Thomas

[ Reply to This | # ]
Take care whether the network is up or not!
Authored by: tedkaz on Apr 08, '06 05:03:18AM

Thanks a bunch, this is great help to an OS X newb coming from the Linux world.



[ Reply to This | # ]