Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 05-07-2007, 08:21 AM   #1
Registered: Mar 2007
Posts: 109

Rep: Reputation: 15
script to mail ipaddress

Hi ,

i am planning to write a script to email the ipaddress , the server is on dynamic ipaddress and i need to email the ipaddress as soon as it changes.
Can anyone please give me an idea as hoe to get this done

Old 05-07-2007, 08:47 AM   #2
Registered: Jun 2005
Distribution: Gentoo
Posts: 552

Rep: Reputation: 30
If you do a little research you can probably e-mail via the command line. Once you figure that out, set up a cron job to e-mail out periodically. Cron jobs aren't hard to setup so if you do a little research on google (based on your distribution) it shouldn't be hard to setup.

You should be able to write a small awk / sed / grep script that can pull out the IP Address of the interface you want. This small script can be enclosed in `` (tic marks) so it can be included in the text of your e-mail.

This would pull out the IP address for interface eth0

`$IFC $EXTIF|$G addr:|$SED 's/.*addr:\([^ ]*\) .*/\1/'`
** Code from -- IPTables for Newbies

I hope this helps,



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
PHP mail() sending as apache@ipaddress DukeLeto Linux - Software 1 04-13-2007 11:24 PM
Can I receive the IPADDRESS also when using $mail command dsids Linux - Newbie 15 05-03-2006 01:20 PM
Shel script mail send ("/" in mail address) problem anaid Linux - Networking 3 08-23-2005 08:41 AM
CGI Script runs to send mail, but mail is never sent robertwo Linux - Newbie 2 06-10-2004 10:57 AM
E-Mail notification to users via SMS (gateway script ok, but notification script?!?) Riku2015 Linux - Networking 10 03-08-2002 11:16 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:48 PM.

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