[mdlug] change ip in config

Tony Bemus tony at bemushosting.com
Fri Jun 24 09:42:02 EDT 2011


I need help with writing a script.  I need to update a config file every
time the computer boots.  I got the part to have it run at boot, but I
need help with writing the script.

I need to get the current eth0 ip address then replace it in a config
file.  My googleing found this to get the ip:

	# ip addr list eth0 |grep "inet " |cut -d' ' -f6|cut -d/ -f1

and that out put is the correct IP with just the ip address
"10.112.5.142".  Now I need to have it replace the IP address in in a
config file line:

	sip.server.host=10.112.5.142

I guess it could replace the line with a new line "sip.server.host=(ip)"
replacing the (ip).  

Thanks in advanced!

Tony Bemus




More information about the mdlug mailing list