Automatic updating of /etc/hosts file?

From: Rejected (rejected_at_hotmail.com)
Date: 11/06/04


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



Relevant Pages

  • authentication varies based on web address
    ... - if i type in the dns name, i get the user login ... (username, pwd, domain), it's the 2 text box login screen. ...
    (microsoft.public.inetserver.iis.security)
  • Re: New user login returns "domain cannot be found"
    ... When you login to the PC as yourself you could be using cached credentials. ... If you run "ipconfig /all" then the DNS ip address it reports is your DC ... On the same machine, using a new user login I have set up, I try ...
    (microsoft.public.windows.server.general)
  • Re: Locate the computer by using login ID information
    ... user login ID information on hand. ... No WINS, only DHCP and DNS. ... from sysinternals tools suite: ...
    (microsoft.public.windows.server.active_directory)
  • Re: Is there a way to forward only email to someone@AOL.com to a s
    ... Also on this site there is a way to test if your script ... map to ourdomain.com in DNS ... you for helping us to solve our SBS problems. ... I have other people on Verizon and they can send to AOL.com users. ...
    (microsoft.public.windows.server.sbs)
  • Re: Dynamic DNS management
    ... One of the irritations is that with a dynamic DNS, ... the IP addresses for the authoritative DNS server of multiple domains ... In the script, the above line is repeated for each domain; ... Perl has very good pattern matching. ...
    (comp.lang.perl.misc)