cronjob not working

I am trying to schedule a job via cronjob. Not sure what the problem is. below is my script and the error.

45 10 * * * /u01/app/oracle/jpark/sched_exp_mis.sh

Error received.

Your "cron" job on tama
/u01/app/oracle/jpark/sched_exp_mis.sh

produced the following output:

/u01/app/oracle/jpark/sched_exp_mis.sh[10]: exp: not found

Can you check if the schedule script is doing the required activity or not ? ? if its delivering the result then you can redirect the error to /dev/null

Hi!

Have you checked your logs?

# tail -f /var/cron/log

I can't view the log.

tama: /var/cron >cat log
cat: cannot open log

its not executing the script at all. I have read, write, and execute permission on the script. Any other ideas?

Where are you seeing the error?

Make sure you can run the script via command line on the box running the cron. Maybe something isn't mounted?

What happens when you run the above command from the command line?

The script executes without any problems.

After the cronjob runs the script, unix sends me an email with the error

Something up with line ten in the script, look into this perhaps?

Please post the output of

ls -l /u01/app/oracle/jpark/sched_exp_mis.sh

Thanks.

This is the output.

tama: /u01/app/oracle/jpark >ls -l /u01/app/oracle/jpark/sched_exp_mis.sh
-rwxrwxrwx 1 oracle dba 402 Dec 1 08:11 /u01/app/oracle/jpark/sched_exp_mis.sh
tama: /u01/app/oracle/jpark >

Thanks. And this one too, please post the output:

crontab -l -uoracle

tama: /u01/app/oracle/jpark >crontab -l -uoracle
crontab: illegal option -- u
crontab: illegal option -- o
crontab: illegal option -- a
crontab: illegal option -- c
crontab: proper usage is:
crontab [file | -e | -l | -r ] [user]
tama: /u01/app/oracle/jpark >

crontab -l uoracle does not work.
do you mean crontabl -l oracle? if so, here is the output.

tama: /u01/app/oracle/jpark >crontab -l oracle
#30 10 * * * echo "testing cronjob" > /u01/app/oracle/crontest.txt
45 10 * * * /u01/app/oracle/jpark/sched_exp_mis.sh
tama: /u01/app/oracle/jpark >

Sorry, try

crontab -l oracle

It appears, so far, that your script calls another script or command that is not executable by user oracle.

Or the script attempts to write to the filesystem where the user oracle does not have write permissions.

Possible?

mrx1350,

If im correct your running the exp (export command of oracle). Maybe your ORACLE instance / Oracle PATH is not defined to that user , and that users doesnt have permission to run the exp command.

Thanks. Setting the path resolved this issue.

here's my 2 cents :

1) "exp" could be a typo (perhaps `expr' ?) ...

2) most probably , "exp" is an executable that is not being found due to PATH lookup failure ;

-- this second theory can be easily tested as follows :

a) try and run the script directly from the shell prompt (as if it was a `date' command) ;

-> if the same error occurs , then your script is messed up for good , and cron has nothing to do with it ;

-> if the error does NOT occur, then you need to adjust your PATH for cron jobs , because cron does NOT read your ".profile" ;

--> this can be done in many ways , but perhaps the simplest is by calling your special script from within an "envelope" shell script , that in turn prepares your PATH , see :

your cron line changes to :

10 10 * * * carrier.sh

the "carrier.sh" is :

PATH=/your/special/dir:$PATH
your_exp_mis.sh

( this is just for your to grasp the idea , ok )

now good luck , and success !

botao