PDA

View Full Version : pump to get hostname



hall
09-28-2005, 01:45 PM
Hi Everyone

Has anybody had any experience using pump to find out and set the "proper" hostname of a box, based on a DNS server? I am trying to get this to start on boot and its not clear to me if this is even possible. If it isn't, could anybody suggest how to switch to using dhcpc instead to achieve the same?

Thanks in advance

Ben

hall
09-29-2005, 01:01 PM
Hi again

In the end I determined that pump could not do this, so I added the line



hostname $(dig -x `ifconfig $DEVICE | grep "inet addr" |awk '{print $2}' | cut -d : -f2` +short |cut -d . -f1)


to /etc/init.d/knoppix-auoconfig, after netdevice detection has finished. I set $DEVICE to eth0, but in the more general case I think leaving out $DEVICE should work. If a network was unavailble I think that the command would fail, and the hostname would remain Knoppix (as set earlier in the script)

Ben