Automatic updating of /etc/hosts file?
From: Rejected (rejected_at_hotmail.com)
Date: 11/06/04
- Next message: dale_at_edgehp.net: "Re: Naming my home lan domain"
- Previous message: Ken: "Re: IPTABLES question"
- Next in thread: Rejected: "Re: Automatic updating of /etc/hosts file?"
- Reply: Rejected: "Re: Automatic updating of /etc/hosts file?"
- Reply: chris-usenet_at_roaima.co.uk: "Re: Automatic updating of /etc/hosts file?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 5 Nov 2004 20:26:45 -0800
Here is my dilemia: I have an RS6000 that has IP printers defined to
dynamic DNS addresses. The spooler won't do DNS lookups, so I have to
set the /etc/hosts file to have the DNS entries. To the user login
script I added
export CLIENTIP=`who am i | sed -e 's/^.*(//' -e 's/)//'`
This will set the unix environment variable of CLIENTIP each time a
user logs in. I then want to take this script (dyndns.sh) to update
the /etc/hosts file
#! /bin/ksh
IP=$CLIENTIP
ME=`whoami`rps
if [ "$IP" ]; then
sed '/^--$ME--/,/^--$ME--/'d /etc/hosts > /etc/hosts
echo "--$ME--\n$IP $ME.homelinux.com\n--$ME--" >>/etc/hosts
fi
This would get tricky if multiple users login at the same time, so I
prefer not to create a new file, "> /etc/hosts" (like I'm currently
testing), but edit the existing file on the file.
I'm open to any and all solutions. Please help. Thanks.
Rejected at Hotmail dot com
- Next message: dale_at_edgehp.net: "Re: Naming my home lan domain"
- Previous message: Ken: "Re: IPTABLES question"
- Next in thread: Rejected: "Re: Automatic updating of /etc/hosts file?"
- Reply: Rejected: "Re: Automatic updating of /etc/hosts file?"
- Reply: chris-usenet_at_roaima.co.uk: "Re: Automatic updating of /etc/hosts file?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|