hello, u can try to save in the var $ip this:
ifconfig eth0 | grep inet | awk '{print $2}'
u will get addr:0.0.0.0
then..with perl..remove the substring addr: and u get the ip
another way is..if u have internet acces..(i dont know
if that server will be local or public) u can do
/usr/bin/curl -s
http://ip.dnsexit.com/ | sed -e 's/ //'
or
/usr/bin/wget -o /dev/null -O -
http://ip.dnsexit.com/
i hope this work for u
good bye.
pd: sorry my english.