Running bteq scripts through crontab

Tools & Utilities

Running bteq scripts through crontab

Hi All,

I want to execute a shell script '' that contains --->

bteq < /a123b/scripts/abc.btq >> /a123b/scripts/hello1.log 2 >> /a123b/scripts/hello1.log

abc.btq is a bteq file containing some teradata bteq statements.
The problem here is that this shell script runs absolutely fine if i execute it manually proving the fact that abc.btq is correct .
The output is a log file containing the statement 'successful'

But when i inserted the same shell script in crontab(a scheduler in unix) to execute it at a specific time everyday, it doesn't run.

My crontab entry looks like this:

* * * * * /a123b/scripts/ >> /a123b/scripts/hello1.log 2 >> /a123b/scripts/hello1.log

Hence the result is a log file of size 0 bytes.
This brings me to the conclusion that the crontab can never execute a bteq script?.
Can anybody help me out with this problem as to how to execute a bteq file using crontab

Re: Running bteq scripts through crontab

The first problem with this could be the path of the script. You can use a small bit of code as follows:
/* Calling shell */
dir=`dirname $0`
bteq < $dir/k_2224.sql > $dir/k_2224.out 2>&1
exit $?
/* End of calling shell */

Put this bit in a shell program and then call the shell program. the cronjob will easily recognise this and run without a hitch. If it doesn't work, you can get back to me and I will look at it again.