ntp.ubuntu.com

Derek Broughton news at pointerstop.ca
Wed Nov 2 20:15:00 UTC 2005


John DeCarlo wrote:

> Can any script expert out there give me pointers on having
> /etc/init.d/ntpdate check my IP address?
> 
> I would like something like:
> 
> if test (IPAddress starts with 192.168); then
> NTPSERVERS="the one I use at home"
> else if test (IPAddress starts with X.Y.Z); then
> NTPSERVERS="the one I use at work"

arping -f -w1 -D -I $IFACE $IP

where IFACE is your interface and IP is a known (often your DHCP server)
address on the subnet.

It's easier with something like whereami.
-- 
derek





More information about the ubuntu-users mailing list