[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Questions regarding dynamic IPs and dhcpcd



On Thu, 12 Jun 1997, Colin R. Telmer wrote:

> So what I want to do is write a script that waits until
> /var/run/dhcpcd.cache-eth0 is created and then mails me
> /etc/dhcpc/hostinfo-eth0. The waiting part is the part I do not know how
> to do unless I just use an infinite loop (with perhaps a 10 minute limit)
> that continously checks for /var/run/dhcpcd.cache-eth0. Is there a better
> way to do this?

Here is a combo of debian and general unix solutions:

bhmit1@hobbes(p2):bhmit1$ more bin/ip
grep IPADDR /etc/dhcpc/hostinfo-eth0 | cut -f2 -d=

I use this to print out just the ip.  In my /etc/init.d/dhcpc:
start-stop-daemon --start --verbose --exec $DAEMON -- -c /root/bin/??
This will run the /root/bin/?? command after dhcp has got it's ip address:
(from the man page)
OPTIONS
       -c filename
              Specifies the command file which  is  invoked  when
              dhcpcd successfully gets an IP address.

Also, with your script, busy waits are never a good programming practice.
I'd put a 5 second sleep command in the loop and add a counter.  When the
counter is at 10, 50 seconds have gone by.

HTH,
Brandon

-----
Brandon Mitchell                         E-mail: bhmit1@mail.wm.edu
  Homepage: http://www.geocities.com/SiliconValley/7877/home.html

"We all know Linux is great...it does infinite loops in 5 seconds."
	--Linus Torvalds


--
TO UNSUBSCRIBE FROM THIS MAILING LIST: e-mail the word "unsubscribe" to
debian-user-request@lists.debian.org . 
Trouble?  e-mail to templin@bucknell.edu .


Reply to: