From owner-freebsd-questions@FreeBSD.ORG Sun Feb 15 05:03:38 2004 Return-Path: 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 E5BBD16A4CE for ; Sun, 15 Feb 2004 05:03:38 -0800 (PST) Received: from sccrmhc13.comcast.net (sccrmhc13.comcast.net [204.127.202.64]) by mx1.FreeBSD.org (Postfix) with ESMTP id AF28843D1F for ; Sun, 15 Feb 2004 05:03:38 -0800 (PST) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from be-well.no-ip.com ([66.30.196.44]) by comcast.net (sccrmhc13) with ESMTP id <2004021513033801600ohbhje>; Sun, 15 Feb 2004 13:03:38 +0000 Received: by be-well.no-ip.com (Postfix, from userid 1147) id B984011; Sun, 15 Feb 2004 08:03:37 -0500 (EST) Sender: lowell@be-well.ilk.org To: References: From: Lowell Gilbert Date: 15 Feb 2004 08:03:37 -0500 In-Reply-To: Message-ID: <441xowv6ja.fsf@be-well.ilk.org> Lines: 41 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii cc: Lowell Gilbert cc: "freebsd-questions@FreeBSD. ORG" Subject: Re: Using dhclient to update zoneedit with my dynamic IP address X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "freebsd-questions@FreeBSD. ORG" List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Feb 2004 13:03:39 -0000 "JJB" writes: > Thanks for this sample, but it exceeds my script coding ability. > I added some comments to your sample but I may be lost. > > #!/bin/sh > > updater_prog = /usr/local/bin/noip2 # program to run > if [ x$reason = xREBOOT ] || \ # is this an reboot or > [ x$old_ip_address = x ] || \ # old ip field empty or > [ x$old_ip_address != x$new_ip_address ]; then # old not EQ new then > if [ -x $updater_prog ]; then # don't know what this does That tests whether the program exists and is executable. > ${updater_prog} -i "$new_ip_address" # exec program > fi > fi > > For my purposes I think this is what I need. > This way zoneedit is only updated when ip changes. > Do I have script correct? > > /etc/dhclient-exit-hooks.sh with this content > #!/bin/sh > # This script only gets called when dhclient runs > # (IE: boot and lease expire) > # Old and new ip address fields are populated by dhclient, > # which keeps the old used IP address in some config file > # so it's not lost on reboot and can be read in at boot time to > # determine if the ip has changed. So with cable or dsl modem > # that stays powered on while PC is powered off still is > # using old IP address. > > updater_prog = /usr/local/bin/wget....rest of command # my wget pgm > > if [ x$old_ip_address != x$new_ip_address ]; # old not EQ new > then ${updater_prog} # exec my pgm > fi Looks like that should work...