Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ipconfig waitall > /dev/null 2>&1



> "Justin C. Walker" <email@hidden> wrote:

BTW, here is my startup script when you wish to use an alias.
Borrowed ideas from Fred Sanchez, thought it might help...

# HOSTNAME and HOSTNAME_IP_ADDRESS must be entered in the /etc/hostconfig
file
# *AND* these must match entries in netinfo under /machines/HOSTNAME
# in order to currently use this scheme

CheckForNetwork

if [ "${NETWORKUP}" = "-YES-" ] &&
[ "${HOSTNAME:=-AUTOMATIC-}" != "-AUTOMATIC-" ] &&
[ "${HOSTNAME_IP_ADDRESS:=-AUTOMATIC-}" != "-AUTOMATIC-" ] &&
[ "${HOSTNAME_IP_NETMASK:=-AUTOMATIC-}" != "-AUTOMATIC-" ]; then

test=$(ifconfig -a | grep en1 | wc -l)
if [ "${test}" -gt 0 ]; then
ifconfig en1 inet "$HOSTNAME_IP_ADDRESS" netmask
"$HOSTNAME_IP_NETMASK" alias 2>&1
inetalias=$(ifconfig -a | sed -n '/inet/p' | sed -n '/broadcast/p' |
sed -n "s/inet[ ]*\($HOSTNAME_IP_ADDRESS\)[ ]*[^ ]*[ ]*[^ ]*[ ]*[^ ]*[ ]*[^
]*/\1/p" | wc -l)
if [ "${inetalias}" -eq 0 ]; then
ConsoleMessage "### INET FAILURE: Could not create required alias
for MY OFFICIAL hostname and ip_address registered in NetInfo... !!!!"
else
ConsoleMessage "Added required alias for MY OFFICIAL hostname and ip
address"
#
# Add the required static route back to localhost
#
route add "$HOSTNAME_IP_ADDRESS" -interface 127.0.0.1 2>&1

# Now run netstat -rn to see if it worked.. it will wait until the reconfig
is
# set...
inetaliasroute=$(netstat -rn | sed -n "s/$HOSTNAME_IP_ADDRESS[
]*\(127.0.0.1\)[ ]*[^ ]*[ ]*[^ ]*[ ]*[^ ]*[ ]*[^ ]*[ ]*[^ ]*/\1/p" | wc -l)

if [ "${inetaliasroute}" -eq 0 ]; then
ConsoleMessage "### INET FAILURE: Could not add required route
for ALIAS to my OFFICIAL HOST!"
else
ConsoleMessage "Added static route for MY Official HOST"
fi
fi
fi
fi


- P.
_______________________________________________
darwinos-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwinos-users
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.