-   General (
-   -   shell script works form command line but not form crontab (

saifee 10-13-2004 06:25 AM

shell script works form command line but not form crontab
i am learning linux and shell scripting , i install oracle database on my linux 8.5, what i want to automate my oracle database export by crontab daily at night time e.g (4:15 am). i wrote a simple shell shell script (as an oracle user ) as below and save the script in
/home/oracle/shellprog/ directory.

# exporting user schema
dt=`date +%Y%m%d`
${ORACLE_HOME}/bin/exp system/oracle owner=scott file=/home/oracle/shellprog/scottexp.$dt

when i execute the script form command line its works fine

[oracle@saif oracle]$ .
login in as an oracle user a write the following crontab file

15 4 * * * /home/oracle/shellprog/

problem is

shell script run form the command lines but not from the crontab via login as an oracle user
i also gave execute permision to script

i try several thing to sort this out but did't work i try these things

1- hard code the $ORACLE_HOME in the script
2-include the directory path of the shell script in the .profile of oracle user
3- include the /home/oracle/shellprog path in the /etc/crontab file
4- copy the (as a root) script in the /etc/cron.daily and and set the /etc/crontab as a root user like this

my /etc/crontab file is as following


# run-parts
01 * * * * root run-parts /etc/cron.hourly
20 13 * * * oracle /home/oracle/shellprog/ run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

i also change the user oracle to root in the /etc/crontab file but same result

all those steps results in negative , any one have solution
thanks in advance


trickykid 10-14-2004 11:27 AM

Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

Other original thread found here:

All times are GMT -5. The time now is 03:46 AM.