When things doesn't run into crontab???


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting When things doesn't run into crontab???
# 1  
Old 04-24-2006
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  
Old 04-24-2006
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  
Old 04-24-2006
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  
Old 04-24-2006
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  
Old 04-24-2006
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script containing Curl doesn't run with crontab

Hello I have a problem with the crontab command when I run a code containing Curl on the command line it runs without fail but as soon as I program it with crontab it executes everything except the curl returns fail thank you for helping me to resolve this problem because since Monday I look... (14 Replies)
Discussion started by: beautymind
14 Replies

2. Shell Programming and Scripting

Job runs manually, doesn't work in crontab

I have a script (/home/admin/run_bkup.sh) that I can run manually to kick off an executable job. I want to run it in crontab, but it doesn't work. Here's the script: shell=/bin/bash today=$(date +"%m-%d-%y") /opt/CPsuite-R77/fw1/bin/upgrade_tools/upgrade_export mgt-svr-bkup-$today << EOF y... (18 Replies)
Discussion started by: df08388
18 Replies

3. Shell Programming and Scripting

Script fails to run properly when run from CRONTAB

Hello all, I'm trying to write a script to gather and send data and it works just fine at the bash command line, but when executing from CRON, it does not run properly. My scripting skills are pretty limited and there's probably a better way, but as I said it works at the command line, but... (12 Replies)
Discussion started by: rusman
12 Replies

4. Shell Programming and Scripting

Doesn't run as a cronjob...

Hi! I have a svn backup script that works perfectly if I execute it from the command line but if I set it as a cronjob to run at night, only part of the code works. So, basically the scripts starts by deleting the folder yesterday and then moves the folder today to the folder yesterday. When... (4 Replies)
Discussion started by: ruben.rodrigues
4 Replies

5. Shell Programming and Scripting

crontab doesn't allow `command` ??

Dear All, We wrote a script to clean email mailbox when they're nearly full and put it in cron : 0 0 * * * /root/quota/autoclean.sh > /root/quota/autoclean.`date '+%Y%m%d'` 2>&1 I've run this command from command prompt, it did work. However, if running from cron, it returned such error... (1 Reply)
Discussion started by: tiger2000
1 Replies

6. Shell Programming and Scripting

IDL job doesn't work from crontab

I have made a script to execute an IDL routine with the purpose to plot data on a fixed time. The problem is that when I include this script in the crontab to run it every night, the IDL part doesn't work (the other commands, like getting data from the database, are carried out though). This... (4 Replies)
Discussion started by: SharkM
4 Replies

7. Shell Programming and Scripting

Expect script doesn't work under crontab

Hi All, Using Expect script when I run it manually it works. But when I put the entry in crontab, the job is still running after 15 hours. The script was created as root. I don't think it's a permission issue. Any idea? This is what I have under root crontab... 00 18 * * 1-5... (4 Replies)
Discussion started by: samnyc
4 Replies

8. UNIX for Advanced & Expert Users

Making things run faster

I am processing some terabytes of information on a computer having 8 processors (each with 4 cores) with a 16GB RAM and 5TB hard drive implemented as a RAID. The processing doesn't seem to be blazingly fast perhaps because of the IO limitation. I am basically running a perl script to read some... (13 Replies)
Discussion started by: Legend986
13 Replies

9. Shell Programming and Scripting

Routine doesn't give output when executed in crontab

I have a script running in the crontab that gets data from a database every hour. Now I would like to execute a fortran routine to process the data in some way, after getting it and saving it locally. I have added the following commands to my script: set convert =... (1 Reply)
Discussion started by: SharkM
1 Replies

10. Shell Programming and Scripting

Shell script doesn't get executed using crontab

I have the following crontab entry to run a shell script for every 30 minutes of every day: 30 * * * * $HOME/main.sh > $HOME/main.log 2>$HOME/error.log after I created the crontab file I have also done: $crontab my_crontab I also check to make sure it exists, by using the following... (11 Replies)
Discussion started by: radhika
11 Replies
Login or Register to Ask a Question