The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Operating Systems > AIX
.
google unix.com



AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with Cron Email Notification sasaliasim AIX 1 04-29-2008 01:02 PM
Crontab change and email notification coolkid Shell Programming and Scripting 3 01-02-2008 03:56 PM
How to add email notification in scripts? redlotus72 UNIX for Dummies Questions & Answers 2 03-14-2005 08:19 AM
Why am I not recieving email notification? Kelam_Magnus Post Here to Contact Site Administrators and Moderators 6 09-03-2002 11:01 PM
email notification if job is killed/dies jacob_gs Shell Programming and Scripting 2 05-15-2002 03:29 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-13-2009
elmesy elmesy is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 11
Cron Job notification email

Hi,

I'm fairly new to Aix and am looking for some help on the following.

I have setup a cron job under root and want it to send the email once it's run to an external email address. I can get it to send the output in an email to me by using mail on the end of the crontab entry. But I would like to get the email thats sent to root once the cronjob has run as displayed below sent to my external address.

/var/spool/mail/root


From daemon Mon Jan 12 15:59:01 2009
Received: (from daemon@localhost)
by (AIX5.3/8.13.4/8.11.0) id n0CFx1eq1044526
for root; Mon, 12 Jan 2009 15:59:01 GMT
Date: Mon, 12 Jan 2009 15:59:01 GMT
From: daemon
Message-Id: <200901121559.n0CFx1eq1044526@
To: root
Subject: Output from cron job su - db2inst1 -c /database/db2inst/sqllib/db2dump/scripts/matt , root@, exit statu s 0
Cron Environment:
SHELL =
PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/java14/jre/bin:/usr/java14/bin
CRONDIR=/var/spool/cron/crontabs
ATDIR=/var/spool/cron/atjobs
LOGNAME=root
HOME=/
Your "cron" job executed on Mon Jan 12 15:59:00 GMT 2009
su - db2inst -c /database/db2inst/sqllib/db2dump/scripts/matt

produced the following output:

Thanks in advance.

Matt.

Last edited by elmesy; 01-13-2009 at 06:31 AM..
  #2 (permalink)  
Old 01-13-2009
funksen funksen is offline Forum Advisor  
Registered User
  
 

Join Date: Nov 2006
Location: Austria/Vienna
Posts: 431
cronjobs should be designed to create no output, an if they create no output no mail is created

your way with sending the output with a mail command in the job is the preferred way



other way:
generate a user cron

install sudo if not already installed

all cron jobs which should send to your email-address must be run from the new users crontab, running commands with sudo/sticky bit

specify a mail alias in /etc/sendmail/aliases for the new user

newuser:youremail@domain

#sendmail -bi

sendmail must run

#startsrc -s sendmail




perhaps there is an easier way
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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




All times are GMT -4. The time now is 05:49 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0