784786 wrote:As others mentioned but left incomplete ... when a script is started by cron, it DOES NOT invoke the user's .profile (or .bash_profile, as the case may be). It is the responsibility of the script itself to set ALL of the environment variables it needs. At the top of that list will be PATH, ORACLE_BASE, ORACLE_HOME, ORACLE_SID.
Could you please help me out..It is really messing me for no fault of mine i believe.
I am trying to schedule a job using crontab, It runs but looks like it either doesn't access the monitor.sql or it fails to produce output as you could see out is 0, but when i run the shell script directly it produces output perefectly.
Here is my script:
oracle-PPOST@pebsdbf01 /home/oracle # crontab -l
23 14 * * * /u01/app/oracle/product/10.2.0/admin/monitor.sh > /u01/app/oracle/product/10.2.0/admin/date.log
-rwxr-x--- 1 oracle oinstall 75 Nov 16 13:58 monitor.sql
-rwxr-x--- 1 oracle oinstall 62 Nov 16 14:19 monitor.sh
set time on
select sysdate from dual;
sqlplus "apps/appsdcs" @/u01/app/oracle/product/10.2.0/admin/monitor.sql
Here is an output:
-rw-r--r-- 1 oracle oinstall 0 Nov 16 14:23 date.log