Re: Execute command upon interface initialization?
On 4/17/07, Ido Admon <[EMAIL PROTECTED]> 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? You can use a '/etc/start_if.' file. If your NIC is fxp0 then a '/etc/start_if.fxp0' file will be run or sourced by the 'rc' system. In http://www.bsdforums.org/forums/showthread.php?t=34607 this type of file is used to set a MTU of 1492 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Execute command upon interface initialization?
On Tue, Apr 17, 2007 at 12:35:41PM -0400, Lowell Gilbert wrote: > Roland Smith <[EMAIL PROTECTED]> 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 "[EMAIL PROTECTED]" -- kelvin ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Execute command upon interface initialization?
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? Sure I could just use cron but that's not very elegant. You could use dns/ez-ipupdate. It is a daemon who updates your dyndns whenever your ip is changed. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Execute command upon interface initialization?
Roland Smith <[EMAIL PROTECTED]> 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. 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 "[EMAIL PROTECTED]"
Re: Execute command upon interface initialization?
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. > Sure I could just use cron but that's not very elegant. On the other hand it is simple, which is a virtue in itself. Roland -- R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725) pgprLIA6NHfrM.pgp Description: PGP signature