The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 04-24-2006
nymus7 nymus7 is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 47
When things doesn't run into crontab???

Could someone explain my problem?

I've the following script...

Code:
#! /bin/ksh
...
vmquery -m $MediaID | awk '
BEGIN {FS=": "
getline expdate <"ExpDate.txt"
}
 $1 ~ /media ID/ {MediaNumber = $NF}
...
 $1 ~ /number of mounts/ {
 "date +%Y"|getline YearToday
 Year4 = YearToday - 4 
 if ($NF > 2000)
 {
   if (expdate ~ "[0-9]\{2\}\/[0-9]\{2\}\/[0-9]\{4\}")
   {
     printf("\t %s \n\n","=case 1==================")                                   >>"/home/op/report.txt"
     printf("%-20s\t %s\t %s\n","Media Number",":",MediaNumber)                         >>"/home/op/report.txt"
...

When I start this program in shell, it is running whitout problem and I've got the result in the file /home/op/report.txt.
But when I start this program via crontab, it is running whitout problem BUT it doesn't create the /home/op/report.txt

What's the problem? what I should doing?
Best regards, nm