LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 12-10-2003, 06:57 AM   #1
digihlp
LQ Newbie
 
Registered: Apr 2002
Location: 33619
Distribution: r5eadhat 7.2
Posts: 6

Rep: Reputation: 0
usin AWK in cron job to send dynamic ip via email


code is

5 30 *** ifconfig -a eth0 | awk ' /inet addr / { print $2 } ' | mail digihlp@hotmail.com,ratinonu@hotmail.com

it emails but doesnt print the ip addy in the body of the email u have to look at the header to find ip
is there a solution am i missing some code
thanks
 
Old 12-10-2003, 07:51 AM   #2
dexter2
LQ Newbie
 
Registered: Nov 2003
Distribution: Red Hat Linux
Posts: 7

Rep: Reputation: 0
try following (spaces are removed) --

/sbin/ifconfig -a eth0 | awk '/inet addr/ { print $2 } ' | mail digihlp@hotmail.com,ratinonu@hotmail.com


it's sending mail and address is in the mail body not in headers.

first just see what this is printing:
/sbin/ifconfig -a eth0 | awk '/inet addr/ { print $2 } '
and then do mailing part


hope this helps
 
Old 12-10-2003, 08:10 AM   #3
digihlp
LQ Newbie
 
Registered: Apr 2002
Location: 33619
Distribution: r5eadhat 7.2
Posts: 6

Original Poster
Rep: Reputation: 0
perfect

thanks works like a charm
thanks
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
cron job email results... ryedunn Linux - General 7 01-26-2005 10:27 PM
cron job to send file via ftp every 1 hour mcalizo Linux - Newbie 1 07-14-2004 03:50 AM
cron job that email a text file paynsr Linux - Newbie 1 03-29-2004 01:36 PM
Cron job , send email mikeshn Linux - General 1 09-21-2003 09:02 AM
Send Email + Txt Attachment Using Cron Job beringer Linux - Newbie 3 01-31-2003 10:23 AM


All times are GMT -5. The time now is 09:07 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration