Re: rc.d NETWORKING dependancy not waiting for network to be up

2007-06-13 Thread Matt Pounsett

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 11-Jun-2007, at 15:32 , RW wrote:


I wrote a lttle rcng  script to handle it it. It runs immediately
before ntpdate,and waits until it can ping my ISP's nameservers
(ignoring the 127.0.0.1 entry in resolv.conf), or you can specify ip
addresses.


Excellent idea.  Thanks for the suggestion!
   Matt



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFGb/lBae4z2vjbC8sRArf/AJ9F4R9g+JPbBnO6oy/UAQTLzcY6+ACg7pXN
Z7aja8X6wd869ITjMqXpyMI=
=sMzI
-END PGP SIGNATURE-
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: rc.d NETWORKING dependancy not waiting for network to be up

2007-06-11 Thread RW
On Mon, 11 Jun 2007 09:28:26 -0400
Matt Pounsett <[EMAIL PROTECTED]> wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> 
> It looks like the NETWORKING dummy dependancy doesn't actually cause  
> the its dependants to wait for networking to be up, but simply for  
> interfaces to be configured.  I'm wondering if this is actually  
> intended, or if it's an unavoidable design flaw, or what?
> 
> I'm noting on my systems that ntpdate and ntpd are trying to start  
> before the network is actually reachable, and therefore both have  
> issues starting.  ntpdate is unable to sync the clock properly
> before ntpd starts, and ntpd doesn't seem to ever be able to sync to
> a time server if it starts trying to contact one before the network
> is fully up... and needs to be restarted after boot in order for it
> to work properly.
> 
> I'm working around the issue by sticking a 20 second delay into /etc/ 
> rc.d/NETWORKING (this is probably way more than necessary, but I'm  
> allowing for a large margin of error) which seems to fix my problem,  
> but is obviously not ideal.

I wrote a lttle rcng  script to handle it it. It runs immediately
before ntpdate,and waits until it can ping my ISP's nameservers
(ignoring the 127.0.0.1 entry in resolv.conf), or you can specify ip
addresses.


$ cat /usr/local/etc/rc.d/networkwait
#!/bin/sh
#
# PROVIDE: networkwait
# REQUIRE: named
# BEFORE:  ntpdate

. /etc/rc.subr

networkwait_enable=${networkwait_enable:-"NO"}
name="networkwait"
rcvar=`set_rcvar`
stop_cmd=":"
start_cmd="wait_network"

wait_network(){
   if [ "$networkwait_ping_hosts" ] ; then
  host_list="${networkwait_ping_hosts}"
   else
  # No hosts supplied - use external nameservers
  host_list=`awk '/^ *nameserver/ {print $2}
'< /etc/resolv.conf | grep -E -v '^127\.0+\.0+\.0*1'`
   fi
   echo -n "Waiting for network access ... "
   while true ; do
  for inet_host in $host_list ; do
 if ping -nc1  $inet_host 2>&1 > /dev/null ; then
echo "ping to ${inet_host} succeeded."
# Re-Sync ipfilter and pf in case
# they had failed DNS lookups
/etc/rc.d/ipfilter resync
/etc/rc.d/pf resync
exit 0
 fi
  done
  sleep 5
   done
}

load_rc_config ${name}
run_rc_command "$1"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"