tags:

views:

87

answers:

2

I am executing a script manually on my UNIX system manually, it runs successfully and updated required records in ORACLE database. How ever when I exwcute the same script with crontab my process exits with the error code 127.

On analysing further, I got there is some problem in these statements.


LOGFILE=sachin ORALOGIN=abc/abc@abcd

cmd='sqlplus ${ORALOGIN} < SQLS >> ${SVC_HOME}/LOGFILES/${LOGFILE}.date +%Y-%m-%d';

eval $cmd

Please suggest a solution

+1  A: 

Are you sure that ${ORALOGIN} and ${LOGFILE} are valid ENV variables when cron executes the script?

Sometimes scripts that work for users don't work for cron because cron executions don't have all the ENV variables that users have.

Arkaitz Jimenez
Yes these variables are defined locally in the script. So no question of environment variables
Sachin Chourasiya
A: 

In the interactive enviroment do

env | grep ORACLE

Long time since I've used sqlplus, but I recall it required some environment variables to function (ORACLE_HOME?) and I'm suspecting your cron job environment does not have these set.

Marko Teiste