From owner-freebsd-questions Fri Jan 5 6:49:35 2001 From owner-freebsd-questions@FreeBSD.ORG Fri Jan 5 06:49:31 2001 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx2.srv.hcvlny.cv.net (mx2.srv.hcvlny.cv.net [167.206.112.45]) by hub.freebsd.org (Postfix) with ESMTP id 0130B37B400 for ; Fri, 5 Jan 2001 06:49:31 -0800 (PST) Received: from s1.optonline.net (s1.optonline.net [167.206.112.6]) by mx2.srv.hcvlny.cv.net (8.10.2/8.10.2) with ESMTP id f05EnT626977; Fri, 5 Jan 2001 09:49:29 -0500 (EST) Received: from optonline.net (ool-18be012f.dyn.optonline.net [24.190.1.47]) by s1.optonline.net (8.10.2/8.10.2) with ESMTP id f05EnSM28317; Fri, 5 Jan 2001 09:49:28 -0500 (EST) Sender: gsam@optonline.net Message-ID: <3A55DEF8.6ACACA28@optonline.net> Date: Fri, 05 Jan 2001 09:49:28 -0500 From: trini0 X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.2-STABLE i386) X-Accept-Language: en MIME-Version: 1.0 To: GB/DEV - Doug Poland , FreeBSD Questions Subject: Re: restarting or renewing dhclient References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Thanks, Ill give this a try. Sure is more complicated than my script. :) GB/DEV - Doug Poland wrote: > trini0@optonline.net said... > > > > Ill be interested in what you have to offer. > > Yes please send it to me. Maybe its along > > the lines of what I had it mind. > > Thanks > > > > trini0@optonline.net > > > > Here it is... > > # crontab -l > # DO NOT EDIT THIS FILE - edit the master and reinstall. > # (/tmp/crontab.dmnXm19120 installed on Tue Dec 5 09:53:15 2000) > # (Cron version -- $FreeBSD: src/usr.sbin/cron/crontab/crontab.c,v 1.12 > 1999/08/28 01:15:52 peter Exp $) > # > */2 * * * * /usr/local/bin/dhclient.refresh 2> /dev/null > /dev/null > > ------------ SNIP --------------- > #! /bin/csh > > set ifname = ed0 > set dns = `grep nameserver /etc/resolv.conf | head -1 | awk '{print $2}' -` > set alive = `ping -c1 $dns | grep "64 bytes from"` > # set alive = `ping -c1 10.10.1.1 | grep "64 bytes from"` #non-existent > host for testing > > if ( $#alive > 0 ) then > # logger connectivity established with $dns > else > logger -t DHCLIENT attempting to re-establish inet connectivity with > $dns > > set leasefile = /var/db/dhclient.leases > @ lease = `grep -n ^lease /var/db/dhclient.leases | tail -1 | awk > -F: '{print $1}' - ` > @ len = `wc $leasefile | awk '{print $1}' - ` > @ tail = $len - $lease > tail -$tail $leasefile > /tmp/lease > logger -t ...dhclient -f /tmp/lease > > ifconfig $ifname down && killall dhclient && dhclient $ifname && > ifconfig $ifname up > set dns = `grep nameserver /etc/resolv.conf | head -1 | awk '{print > $2}' -` > set alive = `ping -c1 $dns | grep "64 bytes from"` > if ( $#alive > 0 ) then > logger -t DHCLIENT connectivity re-established with $dns > else > logger -t DHCLIENT could not re-establish connectivity, > exiting > endif > endif > ------------ SNIP --------------- > > -- > Doug > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- _____________________________ | trini0 | | | / ) | Systems Administrator | / / | Network Engineer | ( ( | email ==> | (((\ \> |/ ) trini0@optonline.net | (\\\\ \_/ /_________________________| \ / \ _/ / / / / To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message