From owner-freebsd-questions@FreeBSD.ORG Tue Apr 17 20:37:11 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4CF0E16A40A for ; Tue, 17 Apr 2007 20:37:11 +0000 (UTC) (envelope-from kelvin@zednaught.net) Received: from exedra.zednaught.net (cpc2-cbly3-0-0-cust101.glfd.cable.ntl.com [86.13.152.102]) by mx1.freebsd.org (Postfix) with ESMTP id 0EA5713C483 for ; Tue, 17 Apr 2007 20:37:10 +0000 (UTC) (envelope-from kelvin@zednaught.net) Received: by delphi.zednaught.net (Postfix, from userid 2000) id E3125B879; Tue, 17 Apr 2007 21:37:06 +0100 (BST) Date: Tue, 17 Apr 2007 21:37:06 +0100 From: kelvin woods To: freebsd-questions@freebsd.org Message-ID: <20070417203706.GA73612@zednaught.net> Mail-Followup-To: freebsd-questions@freebsd.org, Ido Admon References: <20070417145352.M39800@mscc.huji.ac.il> <20070417161636.GA29490@slackbox.xs4all.nl> <44slazklgi.fsf@be-well.ilk.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44slazklgi.fsf@be-well.ilk.org> User-Agent: Mutt/1.4.2.2i Cc: Ido Admon Subject: Re: Execute command upon interface initialization? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Apr 2007 20:37:11 -0000 On Tue, Apr 17, 2007 at 12:35:41PM -0400, Lowell Gilbert wrote: > Roland Smith writes: > > > On Tue, Apr 17, 2007 at 06:02:25PM +0300, Ido Admon wrote: > >> Hello list, > >> I couldn't find any way to execute an arbitrary command upon network > >> interface initialization. My situations is that I have and ethernet card > >> that takes DHCP from a cables provider (not a fixed IP address) and I > >> need to update a DynDNS hostname everytime it does (everytime the IP > >> changes). > >> I couldn't find a way to execute shell commands using the rc system or > >> dhclient, what did I miss? > > > > dhclient-script(8)? Maybe devd(8) will work as well. Just in case you don't manage to find the appropriate text... You'll need to create (in this instance) an /etc/dhclient-exit-hooks script. An excerpt from mine is below, you'll need to create your own "update_ddns" function to update your DynDNS entry. if test "$reason" = "RENEW" || test "$reason" = "BOUND"; then # The old lease has been renewed or the interface is being re-bound. if test "$old_ip_address" != "$new_ip_address"; then # IP address has changed -- update DDNS entry. update_ddns fi fi Hope it helps. > > devd won't work as well, because the timing is a bit off (even if you > only get new addresses at boot time, which isn't guaranteed. > > dhclient-script already has a capability ("hooks") for running scripts > at the appropriate times. If you check the mailing list archive, I > know I have previously posted the script I used to use for exactly the > same purpose. > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" -- kelvin