Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Feb 2004 12:40:14 -0500
From:      "JJB" <Barbish3@adelphia.net>
To:        "freebsd-questions@FreeBSD. ORG" <freebsd-questions@FreeBSD.ORG>
Subject:   RE: Using dhclient to update zoneedit with my dynamic IP address
Message-ID:  <MIEPLLIBMLEEABPDBIEGKECOFLAA.Barbish3@adelphia.net>
In-Reply-To: <441xowv6ja.fsf@be-well.ilk.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for the in-sight into the script code.

I could not get the /etc/dhclient-exit-hooks.sh to run at reboot.

After doing some research I found that dhclient-script
was checking for /etc/dhclient-exit-hooks.

Changed /etc/dhclient-exit-hooks.sh to /etc/dhclient-exit-hooks
and it worked.

Thanks again

-----Original Message-----
From: lowell@be-well.ilk.org [mailto:lowell@be-well.ilk.org]On
Behalf Of Lowell Gilbert
Sent: Sunday, February 15, 2004 8:04 AM
To: Barbish3@adelphia.net
Cc: Lowell Gilbert; freebsd-questions@FreeBSD. ORG
Subject: Re: Using dhclient to update zoneedit with my dynamic IP
address

"JJB" <Barbish3@adelphia.net> 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...



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MIEPLLIBMLEEABPDBIEGKECOFLAA.Barbish3>