![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| SUN Solaris The Solaris Operating System, usually known simply as Solaris, is a free Unix-based operating system introduced by Sun Microsystems . |
|
|
||||
| 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 |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
Quote:
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) |
|
|||
|
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. |
|||
| Google UNIX.COM |