![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to prevent an application from closing a file | jasahl | AIX | 4 | 01-06-2008 09:39 PM |
| Unable to send mail - but no errors found :-( | csaha | Linux | 6 | 02-03-2006 04:21 PM |
| java errors when calling from cron | mntamago | Shell Programming and Scripting | 3 | 11-18-2002 09:50 AM |
| cron command not found | sstevens | UNIX for Dummies Questions & Answers | 4 | 07-18-2002 12:28 AM |
| errors when running a cron job | knarayan | UNIX for Dummies Questions & Answers | 2 | 01-23-2002 02:00 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
How do I prevent cron from returning errors on a file not found?
find: /home/Upload/*: No such file or directory
I am getting a find error when I run for FILE in `find /home/Upload/* -prune -type f -newer TIMEFILE` do I need to run this job every 10 minutes to upload any new files that were added. Is there an easy way to prevent this? Thanks |
|
||||
|
2> /tmp/file
var=$(wc -l /tmp/file) if [ $var -gt 0 ]; then cat /tmp/file | mail -s "copy job error" your@e.mail; rm /tmp/file; fi or generate an error log with timestamps |
|
||||
|
Thanks funsen,
I am confused as to how it fits together. I can see running the cron job and writing standard error to a temp file on the cron job. 2> /tmp/file What I don't understand when not to fire the awk script if there is an error. var=$(wc -l /tmp/file) if [ $var -gt 0 ] then cat /tmp/file | mail -s "copy job error" your@e.mail; rm /tmp/file; fi Thanks again for replying |
|
||||
|
if /tmp/file is not empty, which means an error occured, you get a mail, if not you get nothing - this can cause problems, because you don't know if the script didn't run at all
the wc -l is not needed, just wc works too, or you can just check if the file exists with "if [ -f /tmp/file ]; then .... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|