|
Home > Archive > Red Hat Topics > June 2006 > Cronjob does not run properly
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Cronjob does not run properly
|
|
| jthwong1@gmail.com 2006-06-07, 7:12 pm |
| Details:
home directory - /home/userid
1) 1 PERL program - program.pl
Takes couple parameters from ARGV and generates 1 output file in the
same directory. The program will also generate some stdout to show the
progress. I can run it with 'perl program.pl variable1 variable 2'. The
porgress is shown in stdout and the output file is generated.
2) 1 bash script - script.sh
echo START `date`
/usr/bin/perl /home/userid/program.pl variable1 variable2
echo STOP `date`
I can run it with '/bin/bash /home/userid/script.sh' in the command
line, echo statements display, the PERL program runs ok with the
correct output file and the progress is shown in stdout.
Problem: when I put the script.sh in crontab - 5 12 * * * /bin/bash
/home/userid/script.sh > /home/userid/log.txt, log.txt is generated.
However,
log.txt has the output from the echo START and echo STOP statements but
not the PERL program. I check the time generated by `date` in the echo
statements and they are the same. The PERL program takes about 15 sec
to run. It seems to me that the PERL script was never ran at all.
Can anyone shed some light on this? I have spent too much time on this
already.
| |
| jthwong1@gmail.com 2006-06-07, 7:12 pm |
| Pleaes ignore this topic. I found the problem after stop drinking
coffee - I need to put in 'absolute path' in all the input or output
file in the program!!!
jthwong1@gmail.com wrote:
> Details:
>
> home directory - /home/userid
>
> 1) 1 PERL program - program.pl
>
> Takes couple parameters from ARGV and generates 1 output file in the
> same directory. The program will also generate some stdout to show the
> progress. I can run it with 'perl program.pl variable1 variable 2'. The
> porgress is shown in stdout and the output file is generated.
>
> 2) 1 bash script - script.sh
>
> echo START `date`
> /usr/bin/perl /home/userid/program.pl variable1 variable2
> echo STOP `date`
>
> I can run it with '/bin/bash /home/userid/script.sh' in the command
> line, echo statements display, the PERL program runs ok with the
> correct output file and the progress is shown in stdout.
>
> Problem: when I put the script.sh in crontab - 5 12 * * * /bin/bash
> /home/userid/script.sh > /home/userid/log.txt, log.txt is generated.
> However,
>
> log.txt has the output from the echo START and echo STOP statements but
> not the PERL program. I check the time generated by `date` in the echo
> statements and they are the same. The PERL program takes about 15 sec
> to run. It seems to me that the PERL script was never ran at all.
>
> Can anyone shed some light on this? I have spent too much time on this
> already.
|
|
|
|
|