The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > OS Specific Forums > SUN Solaris
Google UNIX.COM


SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems .

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Weird Issue with crontab. Cameron HP-UX 3 04-21-2008 08:36 PM
crontab issue vaddi HP-UX 11 01-28-2008 02:07 AM
Crontab change and email notification coolkid Shell Programming and Scripting 3 01-02-2008 11:56 AM
Crontab Issue rickyt00 UNIX for Dummies Questions & Answers 2 08-06-2005 06:31 AM
crontab issue Semper_Tempus SUN Solaris 6 07-19-2005 07:13 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-18-2008
Registered User
 

Join Date: Jun 2008
Posts: 2
Crontab email issue

Hi,

I have a script that sends a db extract file as an email attachment.

I have a crontab created to run it everyday at 8 am..

00 08 * * * ksh /home/rtaaa/tbasd/report.sh > /home/rtaaa/tbasd/logs/report.log

When i just run the "ksh /home/rtaaa/tbasd/report.sh > /home/rtaaa/tbasd/logs/report.log" from the command prompt, the email will be sent out without any issues.. but when its triggered by the crontab, the email is not getting sent.. the whole script is running well except the email part.

This is what i am doing to send the file: "sendmail $ADDR < $MAILFILE"

I have been trying to debug this without success for a while, any help is appreciated.

Thanks.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-18-2008
seg seg is offline
Registered User
 

Join Date: Aug 2003
Posts: 59
first

take out the ksh in the crontab and include
#!/bin/ksh
at the top of the script.

second

you can record the errors in your log with 2>&1

so give this a shot:
Code:
00 08 * * * /home/rtaaa/tbasd/report.sh >> /home/rtaaa/tbasd/logs/report.log 2>&1
Reply With Quote
  #3 (permalink)  
Old 06-19-2008
Registered User
 

Join Date: Jun 2008
Posts: 2
found the culprit

Thanks for helping me find the error..

Now i could trace the error:

but i am getting this error: "sendmail: not found"

Again, I am getting this error only when Its run by the cron. I won't get this when i run it from the command prompt.

thanks,
Rama
Reply With Quote
  #4 (permalink)  
Old 06-19-2008
seg seg is offline
Registered User
 

Join Date: Aug 2003
Posts: 59
Quote:
Originally Posted by ryannam View Post
Thanks for helping me find the error..

Now i could trace the error:

but i am getting this error: "sendmail: not found"

Again, I am getting this error only when Its run by the cron. I won't get this when i run it from the command prompt.

thanks,
Rama

Best way to solve this (considering best practices) is specify full path name to sendmail in the script. You can find out where sendmail lives by typing:

which sendmail

(hint: it's probably /usr/lib/sendmail)
Reply With Quote
  #5 (permalink)  
Old 06-20-2008
Registered User
 

Join Date: Jun 2008
Posts: 12
How to disable crontab from sending email to user from configuration.?

I mean instead of redirecting > /dev/null 2>&1 at the crontab entry.
Reply With Quote
  #6 (permalink)  
Old 06-20-2008
Registered User
 

Join Date: Feb 2008
Location: Dayton, Ohio
Posts: 1
Crontab email issue

Instead of specifying the complete pathname for each program,
you might want to make the script self-sufficient by including PATH and umask settings:

PATH=/bin:/usr/bin:/usr/lib:/usr/local/bin
export PATH
umask 022

Handle all redirection within the script as well. It also helps to create a directory just for cron jobs, so your final script would be something like /usr/local/cron/run-report.
Reply With Quote
Google UNIX.COM
Reply

Tags
sendmail

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:54 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0