From owner-freebsd-questions@FreeBSD.ORG Wed May 3 21:43:55 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BB6C216A402 for ; Wed, 3 May 2006 21:43:55 +0000 (UTC) (envelope-from fbsd@a1poweruser.com) Received: from mta10.adelphia.net (mta10.adelphia.net [68.168.78.202]) by mx1.FreeBSD.org (Postfix) with ESMTP id CB26D43D49 for ; Wed, 3 May 2006 21:43:54 +0000 (GMT) (envelope-from fbsd@a1poweruser.com) Received: from barbish ([70.39.69.56]) by mta10.adelphia.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with SMTP id <20060503214353.NITH14145.mta10.adelphia.net@barbish>; Wed, 3 May 2006 17:43:53 -0400 From: "fbsd" To: "Daniel Bye" , Date: Wed, 3 May 2006 17:43:48 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <20060503204159.GB79222@catflap.slightlystrange.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 Cc: Subject: RE: dhclient-exit-hooks X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: fbsd@a1poweruser.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 May 2006 21:43:55 -0000 I figured the "Shared object not found" error is another sign of what is wrong in general so I commented out the mail command to concentrate on just the logger problem. During testing the logger problem I determined the script "if" statement is not working. Problem seems more like bug in how and or when during the boot process the script is getting executed. This has nothing to do with my script code. This is how FreeBSD is handling the default dhclient-script that comes pre installed on the system. The recorder directives have made no difference. Please note I am not using the isc-dhcp port dhclient. I am running the dhclient that comes as part of the base install of FreeBSD. I have ifconfig_dc0="DHCP" in rc.conf to launch /sbin/dhclient-script. dhclient-script calls dhclient-exit-hooks I don't think the recorder directives get into play because dhclient does not use the rc.d environment. I know the dhclient-exit-hooks script is executing because of the echo commands I put in it before and after the IF statement. I also know the dhclient variables are being loaded in the /etc/dhcpd.name-servers file because I empty it before rebooting system, and after words I edit it and it contains the correct values. I am beginning to think that something changed between 4.x and 6.0 in the way the dhclient-script get processed during boot. It's acting like it gets executed to early in the boot process. Do I have enough evidence on this to submit a bug report??? -----Original Message----- From: owner-freebsd-questions@freebsd.org [mailto:owner-freebsd-questions@freebsd.org]On Behalf Of Daniel Bye Sent: Wednesday, May 03, 2006 4:42 PM To: Daniel Bye; freebsd-questions@freebsd.org Subject: Re: dhclient-exit-hooks On Wed, May 03, 2006 at 03:35:13PM -0400, fbsd wrote: > I do not see why postfix would have any thing to do with logger not > working. ACK. I've been talking about the "Shared object not found" error, which is definitely, from the error message you posted, caused by postfix not being able to find pcre. Has that problem gone away with the addition of the rcorder directives? (I've made the assumption here that your script is being called by rc, from one of your rc.d directories - if this is NOT the case, then you can pretty well ignore all I've said, and I apologise for being off the mark...) > I added some ehco statments to test if the "if" statment is working. > In this pass /etc/dhcpd.name-servers.tmp = /etc/dhcpd.name-servers > so the second echo should not have been executed, but it was Have you run the script with xtrace turned on? That at least will show you which lines of the script are being run. It might help you narrow down on the part that goes wrong. I really can't see anything wrong with the logic or syntax of your script, so this part of it is somewhat baffling to me. > >From testing it looks like only the dhcpc variables plus mv, > and echo commands work in the script. > > from the boot log > dc0: link state changed to DOWN > dc0: no link ....dc0: link state changed to UP > got link > dc0: link state changed to DOWN > before if check > after if check > DHCPREQUEST on dc0 to 255.255.255.255 port 67 > dc0: link state changed to UP > DHCPACK from 10.0.10.2 > dc0: link state changed to DOWN > bound to 10.0.10.4 -- renewal in 43200 seconds. > > > and here is the dhclient-exit-hooks script > > #!/bin/sh > > # PROVIDE: dhclient-exit-hooks > # REQUIRE: SERVERS > > ############### Start of refresh dhcpd dns ip #################### > # This script will propagate to dhcpd the changed dns servers ip > address > # which dhcp-client puts in resolv.conf. > # > # In dhcpd.conf replace the "option domain-name-servers" line with > this > # > # include "/etc/dhcpd.name-servers"; > # > # Spript uses the dhcpc variables to build temp line in dhcpd > format. > # Then compare temp content to production content. > # If different replace production content with new content from > temp, > # and restart dhcp to reread dhcpd.conf containing new ISP dns ip > addresses. > # > # logging event and sending email to user root is optional. > # > # Note: All LAN machines using dhcpd will not get new ISP dns ip > addresses > # until they reboot or their lease comes up for renewal. > # > # Each of the following lines must be one long line. IE: no wrap > arounds > #################################################################### > #### > > # load my_domain_name_servers variable with ISP dns ip addresses > from dhcpc > my_domain_name_servers=`echo $new_domain_name_servers | sed -e 's/ > /, /g'` > > # Create single line in file to be included in dhcpd.conf > echo "option domain-name-servers $my_domain_name_servers ;" > > /etc/dhcpd.name-servers.tmp > > echo " before if check" > > # See if different from what production file contains > cmp -s /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers > if [ $? -gt 0 ]; then > echo " after if check" > # move the new file into place > mv /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers > # restart dhcp using whatever is appropriate for your platform > #service dhcpd restart > #/usr/local/etc/rc.d/isc-dhcpd.sh restart -q > # Write message to /var/log/dhcpc.log to document event. > /usr/bin/logger -p user.warning -t dhclient Your ISP DNS IP > addresses changed. > # Write message to /var/log/dhcpd.log to document event. > /usr/bin/logger -p local1.warning -t dhclient Your ISP DNS IP > addresses changed. > fi > #rm -f /etc/dhcpd.name-servers.tmp > ############### End of refresh dhcpd dns ip script > ################### [---snip---] > > > using sendmail to construct the email made no difference. > > > Still get this message > > > > > > /libexec/ld-elf.so.1: Shared object "libpcre.so.0" not found, > > > required by "send-mail" Has this gone away? --^ Apologies for the crossed wires. Dan -- Daniel Bye PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc PGP Key fingerprint: D349 B109 0EB8 2554 4D75 B79A 8B17 F97C 1622 166A _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \