Re: How to tell IP address of remote machine?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Timothy Murphy wrote:
> I had a little program which I ran each day
> as a cron job to mail me the IP address of a machine
> in a different country.
> I give the program sm.py below;
> I can't remember where I found it.
>
> In any case, the program has ceased to work
> because the site heliohost seems to have gone off-line.
>
> I wonder if anyone knows of an alternative site
> which I could substitute?
> Or an alternative program?
>   
If I understand you correctly....  This script runs on a system and then
emails you the results so you know its IP address since it may change as
it is on a link where the IP address is dynamically assigned.

It has been a long time since I've done that....  I recall I had pppoe
(or something like that) detecting when the link went down/up and email
the IP address.....  But, maybe that isn't what you are using....

On the other hand, I did another thing once upon a time....but simply
used a shell script and the output from ifconfig with a bit of grepping
and cutting.

> -------------------------------------
> SENDMAIL = "/usr/sbin/sendmail"
> import os
> import socket
> import urllib2
> import sys
> import time
> tt = time.ctime()
> response = urllib2.urlopen("http://darkstar.heliohost.org/ip.php";)
> ipaddr = response.readline().split('<')[0]
> f = open("mylog.txt", "w")
> f.write(ipaddr + " " + "on" + " " + tt + "\n" )
> f.close()
> p = os.popen("%s -t -fgayleard@xxxxxxxx" % SENDMAIL, "w")
> p.write("To: gayleard@xxxxxxxxxx\r\n")
> p.write("From: Timothy Murphy <gayleard@xxxxxxxxxx>\r\n")
> p.write("Subject: Anghiari IP address\r\n")
> p.write("\r\n")
> p.write(ipaddr + "\r\n")
> p.close()
> sys.exit()
> -------------------------------------
> [tim@althea ~]$ sudo cat /etc/cron.daily/ip-address
> #!/bin/sh
>
> /usr/bin/python /home/tim/sm.py
> -------------------------------------
>
>   


-- 
But since I knew now that I could hope for nothing of greater value than
frivolous pleasures, what point was there in denying myself of them? --
M. Proust Guess Who! http://tinyurl.com/mc4xe7

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines

[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux