From owner-freebsd-questions@FreeBSD.ORG Tue May 2 13:12:23 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 4189D16A406 for ; Tue, 2 May 2006 13:12:23 +0000 (UTC) (envelope-from fbsd@a1poweruser.com) Received: from mta13.adelphia.net (mta13.adelphia.net [68.168.78.44]) by mx1.FreeBSD.org (Postfix) with ESMTP id CC84043D49 for ; Tue, 2 May 2006 13:12:22 +0000 (GMT) (envelope-from fbsd@a1poweruser.com) Received: from barbish ([70.39.69.56]) by mta13.adelphia.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with SMTP id <20060502131221.TLRG27153.mta13.adelphia.net@barbish> for ; Tue, 2 May 2006 09:12:21 -0400 From: "fbsd" To: "freebsd-questions@FreeBSD. ORG" Date: Tue, 2 May 2006 09:12:21 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" 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) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 Importance: Normal Cc: Subject: 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: Tue, 02 May 2006 13:12:23 -0000 When this script runs the logger statements do not create any message in the targeted log files. IF I execute the same logger statements from the command line they work as expected. This is the boot time messages. dc0: link state changed to DOWN dc0: no link ....dc0: link state changed to UP got link dc0: link state changed to DOWN 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. IF I execute the cat command to issue the notification email from the command line it works fine, but when used in the script I get these messages during boot process. I am running postfix launched by the sendmail wrappers on a FreeBSD 6.0 system. "~/.mailrc": No match. DHCPREQUEST on dc0 to 255.255.255.255 port 67 /libexec/ld-elf.so.1: Shared object "libpcre.so.0" not found, required by "send-mail" dc0: link state changed to UP DHCPREQUEST on dc0 to 255.255.255.255 port 67 DHCPACK from 10.0.10.2 dc0: link state changed to DOWN bound to 10.0.10.4 -- renewal in 43200 seconds. #! /bin/sh ############# Start of refresh dhcpd dns ip script ################# # This script will propagate to dhcpd the changed dns servers ip # addresswhich dhcp-client puts in resolv.conf. # # In dhcpd.conf replace the "option domain-name-servers" line with this # # include "/etc/dhcpd.name-servers"; # # Script 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 around #################################################################### #### # 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 # See if different from what production file contains cmp -s /etc/dhcpd.name-servers.tmp /etc/dhcpd.name-servers if [ $? -gt 0 ]; then # 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. logger -p user.warning -t dhclient Your ISP DNS IP addresses changed. # Write message to /var/log/dhcpd.log to document event. logger -p local1.warning -t dhclient Your ISP DNS IP addresses changed. # Send notification email to root user. This can wrap to next line. # cat << EOF | mail -s "dhcp client changed ISP DNS IP addresses" root #The dhclient-exit-hook script was invoked and has determined that your #ISP changed the IP address of their DNS servers. The new values have been #auto updated to dhcpd.conf and dhcp restarted so they are now in effect. # #Note: All LAN machines using dhcpd will not start using the new ISP dns #ip addresses until they reboot or their lease comes up for renewal. #EOF fi rm -f /etc/dhcpd.name-servers.tmp ############### End of refresh dhcpd dns ip script ###################