LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-12-2009, 11:00 PM   #1
SuperDude123
Member
 
Registered: Nov 2008
Posts: 158

Rep: Reputation: 30
email me my IP...how do I do it?


Say I wanted to have my system email me its IP (without using no-ip.com), how would I make it happen?

I know that this command will give me my external IP:

lynx --dump http://www.cyberciti.biz/files/what-...ip-address.php | grep 'Your IP add' | cut -d: -f2


So how do I have the results of that emailed to me say every hour or something?
 
Old 10-12-2009, 11:13 PM   #2
avijitp
Member
 
Registered: May 2005
Location: India
Distribution: FC11, Debian/Ubuntu, RHEL, Solaris, AIX, HP-UX
Posts: 161

Rep: Reputation: 32
Write a very simple script that will run hourly like this::

Code:
#!/bin/bash
IP=`lynx --dump http://www.cyberciti.biz/files/what-...ip-address.php | grep 'Your IP add' | cut -d: -f2`
echo $IP | mail -s "IP Address" yourmail-id
 
Old 10-13-2009, 04:37 AM   #3
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835

Rep: Reputation: 102Reputation: 102
Quote:
Originally Posted by SuperDude123 View Post
Say I wanted to have my system email me its IP (without using no-ip.com), how would I make it happen?

I know that this command will give me my external IP:

lynx --dump http://www.cyberciti.biz/files/what-...ip-address.php | grep 'Your IP add' | cut -d: -f2


So how do I have the results of that emailed to me say every hour or something?
In your post title, you say "email me my IP". In your message body, you say "email me its IP". These are two distinct things that are not the same. Decide which one you want and post again.

Your machine has an IP. Your server has an IP. Thw two IP addresses are and must be different. Which one do you want?
 
Old 10-13-2009, 04:45 AM   #4
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
I do it a little bit differently.

I have a script on my website that returns the IP address of the client that invokes it. There is a command option on it that will cause it to write the IP address to a data file on the website.

My workstation runs wget once an hour as a cron to hit that script with the proper command option.

So, wherever I am, all I have to do is point a browser at the data file on my site and I know my workstation address.
 
Old 10-13-2009, 10:00 AM   #5
manwithaplan
Member
 
Registered: Nov 2008
Location: ~/
Distribution: Arch || Sidux
Posts: 393

Rep: Reputation: 45
You can use this to get your ip... and use mail to send it

Code:
curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"
Then use a cron to send the email via mailx ... you can encapsulate into a script, or run the full command in the cron

Last edited by manwithaplan; 10-13-2009 at 10:06 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Send email to specific SMTP servers per email from my server? neilius Linux - Server 6 06-25-2009 07:31 AM
Apache virtual host send email without email server SibLiant Linux - Software 6 06-03-2009 10:46 PM
run a shell script/cronjob when any email arrive to specific email address ikillu Linux - General 3 05-30-2009 09:18 AM
Pipe'ing the ouput of 'cat' into 'mutt' (email) losses newlines when email received helptonewbie Linux - Newbie 2 08-28-2008 04:16 AM
How to Import Microsft outlook Email in any Red hat 9 Email Software mobassir Linux - Software 0 07-26-2003 05:08 AM


All times are GMT -5. The time now is 06:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration