The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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



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
Question about several things in C V4D3R High Level Programming 1 09-13-2007 10:56 PM
Complicating things? bconnor High Level Programming 1 03-30-2006 10:07 PM
how to convert things from csh to sh forevercalz Shell Programming and Scripting 1 10-28-2005 03:46 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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
  #2 (permalink)  
Old 04-24-2006
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Post how you run it from command line and how it is set up in crontab (as the portions of the script you posted don't show that output is being re-directed to the file mentioned).
  #3 (permalink)  
Old 04-24-2006
nymus7 nymus7 is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 47
Hi

1.By command line :
Code:
unix:/home/op> nbu_report.sh
2.By crontab :
Code:
00 06 * * * /home/op/nbu_report.sh
Thats' it!
-nymus
  #4 (permalink)  
Old 04-24-2006
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Okay, I scrolled all the way to the right and saw your >> "/home/op/report.txt"
(Sorry about that)

Does your program put in the file ( if there is nothing to report ) that there was no records/info to report? Example - if I am running something for all my servers and there are no errors on any server, I put that there were no errors today as one of my last steps (by checking the file size of /home/op/report.txt - if it's zero at the end of my script, then there were no errors (or my script is screwed up)).
  #5 (permalink)  
Old 04-24-2006
nymus7 nymus7 is offline
Registered User
  
 

Join Date: Apr 2005
Posts: 47
Hi

Yeah, I understand what's you means about perhaps "is nothing to report" !
But when I've started by command line the was a report and with the crontab the wasn't a report.
So, I check-up my script again and I founded the error : I was used the command vmquery but the PATH from cron doesn't understand that, so I've putting the PATH and now it's running....
-nymus
Sponsored Links
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:45 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