External IP address for use in CONKY

How to do things, solutions, recipes, tutorials
Post Reply
Message
Author
User avatar
wuwei
Posts: 800
Joined: Sat 15 Sep 2007, 11:59
Location: formerly de; now in tranquility

External IP address for use in CONKY

#1 Post by wuwei »

I have been battling the issue of showing the external IP address in Conky on and off.
It seems that the problem was solved here
http://www.murga-linux.com/puppy/viewtopic.php?p=483184

But since that post none of the codes mentioned there seem to work anymore.
So I did a little research and experimenting and found this code to work alright in establishing a file with just the external IP in it.

Code: Select all

my_ipno=$(wget http://cmyip.com -qO - | grep -Ewo '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' | uniq)
echo $my_ipno >/tmp/iptest
I found part of it on the forum here, but can't seem to locate the post anymore, where it was mentioned. So credit goes to the unknown author.

More details on the issue can be found in my German thread here
http://murga-linux.com/puppy/viewtopic.php?t=63720
second and third post down the page.

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

External IP address

#2 Post by L18L »

Hi wuwei,

what about "official" solution

Code: Select all

wget -O - -q icanhazip.com
/usr/sbin/ipinfo wrote:#!/bin/bash
# AUTHOR: Vovchik
# PURPOSE: GUI to show IP config info
# DATE: 14 May 2009
#120201 BK: internationalized.
#120323 replace 'xmessage' with 'yaf-splash'.

export TEXTDOMAIN=ipinfo
export OUTPUT_CHARSET=UTF-8

# --------------
# functions
# --------------

# --------------
get_data()
# --------------
{
nl='
'
# external ip
var0="`wget -O - -q icanhazip.com`"

User avatar
wuwei
Posts: 800
Joined: Sat 15 Sep 2007, 11:59
Location: formerly de; now in tranquility

#3 Post by wuwei »

Okay L18L

(schoen dich hier drueben zu sehen)

Your code works, but what is the file for?
I need the number for Conky, not just stand-alone?

User avatar
L18L
Posts: 3479
Joined: Sat 19 Jun 2010, 18:56
Location: www.eussenheim.de/

External IP address

#4 Post by L18L »

Code: Select all

 echo `wget -O - -q icanhazip.com` > /tmp/iptest 
is shorter than

Code: Select all

my_ipno=$(wget http://cmyip.com -qO - | grep -Ewo '\b([0-9]{1,3}\.){3}[0-9]{1,3}\b' | uniq)
echo $my_ipno >/tmp/iptest
It is not my code, it is vovchik´s
:)

User avatar
wuwei
Posts: 800
Joined: Sat 15 Sep 2007, 11:59
Location: formerly de; now in tranquility

#5 Post by wuwei »

A point well taken L18L.

I'll store both codes away safely.
These websites for showing one's IP come and go. So its a good idea to have several options.

Thanks for your input.

Post Reply