On Fri, 2 Nov 2001, Charles Steinkuehler wrote:
> > Another useful thing to put on the weblet homepage would be the current IP
> > address of the external interface. This would be useful for those of us
> > with dynamic IPs. It's not really hard to check the logs to find the
> > information, but having it on the weblet homepage would be handy.
> >
> > If anyone has the time to figure out how to do this, go for it.
>
> hostname -i
hostname -i yields my internal address, presumably because that is how
/etc/hosts knows my host name ip by the hostname.
The following works with ifconfig:
cat <<EOF >/usr/bin/get_inet_addr
#!/bin/sh
set -- `/sbin/ifconfig $1 | grep "inet addr"`
IFS=':'
set -- $2
echo $2
EOF
chmod +x get_inet_addr
get_inet_addr eth0
but I don't have an Eigerstein box up so I can't test one to work with
iproute2. I imagine it would use "ip addr show eth0", something like:
cat <<EOF >/usr/bin/get_inet_addr
#!/bin/sh
set -- `/sbin/ip addr show $1 | grep "inet"`
IFS='/'
set -- $2
echo $1
EOF
chmod +x get_inet_addr
get_inet_addr eth0
but this could be buggy. :)
> This is also printed out in the network page of weblet. This (and many
> other potentially useful bits of information) have not been added to the
> home page, as that would require it to become a cgi-script, but feel free to
> make any changes you want...they're just HTML pages (and shell script)
For a web page, having all this information does seem more useful than
having just one bit of it.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<[EMAIL PROTECTED]> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...2k
---------------------------------------------------------------------------
_______________________________________________
Leaf-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-user