Martin Marques wrote:
Is there an easy way to update /etc/hosts after my XDSL connection comes up? I want to have the name I have with ez-ipupdate and the IP address that is assigned to my computer also in /etc/hosts.
If you want this to happen every time you bring up the PPP connection, you could create a /etc/ppp/ip-up.local script to edit /etc/hosts. I don't remember the order that things are passed to the script, but one of them is the IP address. A quick, cheap, and dirty way would be to add the hostname/IP address to the end of the file when using something like: (replacing <your hostname> with yours.)
#!/bin/bash # # Script to add <your hostname> to /etc/hosts. # echo <your host name> $4 >> /etc/hosts
You would then need a /etc/ppp/ip-down.local to remove it again.
#!/bin/bash # # Script to remove <your hostname> from /etc/hosts. # sed -i -e "/<your hostname>/d" /etc/hosts
A somewhat better /etc/ppp/ip-up.local script would be:
#!/bin/bash # # Script to add <your hostname> to /etc/hosts. # sed -i -e "/<your hostname>/d" /etc/hosts echo <your host name> $4 >> /etc/hosts
Now, these scripts have not been tested, and I may have the parameter number wrong. I am still working on my first cup of coffee. You may want to run "man pppd" and scroll way down to the section on scripts.
Mikkel