On 2016-02-01 15:52, Patrick Shanahan wrote:
* Carlos E. R. <> [02-01-16 09:20]:
following might help :) ::
# <--------- Cool Functions by Crouse--------> # Cool Functions for your .bashrc file.
#myip - finds your current IP if your connected to the internet myip () { lynx -dump -hiddenlinks=ignore -nolist http://checkip.dyndns.org:8245/ | awk '{ print $4 }' | sed '/^$/d; s/^[ ]*//g; s/[ ]*$//g' }
Telcontar:~ # cat /usr/local/bin/whatismyIP #!/bin/bash # Probar tres veces para conseguir la IP, a veces falla. # Try up to three times because it can fail for((i=0;i<3;i++)) do echo "Intento $i" set `wget -qO - checkip.dyndns.org | cut -d":" -f2 | cut -d"<" -f1 | cut -d" " -f2` if test -n "$*" ; then echo "La IP actual es: " $* exit else echo "IP no encontrada, probando otra vez" /bin/sleep 5 fi done Telcontar:~ #
And I have a script from noip which queries my ip addr and reports changes back to noip.com adjusting when necessary. The query runs every 10 minutes but miniminal system load and only reports changes which only happen if I *reset* my modem/router (not power cycle) or there is an extended network outage (which has happened) or I direct the router to request a new ip addr.
Except for wide network outage, I cannot remember a time when my system was inaccessable from the net :) (fingers crossed).
My ISP changes the IP on router reset or power cycle. On ADSL, a phone disconnect does it. On fibre, I'm unsure. -- Cheers / Saludos, Carlos E. R. (from 13.1 x86_64 "Bottle" at Telcontar)