Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell script installed to crontab execute half way

Status
Not open for further replies.

sillyVM

Technical User
Feb 14, 2007
144
US
I have a shell script, that will export two oracle database dump file. If I execute the script by hand:

. /path_to_file/backup.sh

it will work fine, but if I install it using crontab -e

@daily . /path_to_file/backup.sh

it will only execute the first export, but not the second export.

Here is that script
Code:
su - oracle -c '
PATH=${PATH}:/home/oracle/oracle/product/10.2.0/db_1/bin/

ORACLE_HOME=/home/oracle/oracle/product/10.2.0/db_1
ORACLE_SID=orclsvr
ORATAB=/etc/oratab
ORACLE_HOME_LISTNER=$ORACLE_BASE
ORACLE_BASE=$ORACLE_HOME

export ORACLE_BASE ORACLE_SID ORATAB ORACLE_HOME ORACLE_HOME_LISTNER

exp db_user1/db_password1 file=/home/oracle/dailybackups/db_user1.dmp log=/home/oracle/dailybackups/db_user1.log rows=yes indexes=yes
rar a /home/oracle/dailybackups/db_user1.rar /home/oracle/dailybackups/db_user1.dmp

exp db_user2/db_password2 file=/home/oracle/dailybackups/db_user2.dmp log=/home/oracle/dailybackups/db_user2.log rows=yes indexes=yes
rar a /home/oracle/dailybackups/db_user2.rar /home/oracle/dailybackups/db_user2.dmp

'
 
anyone has any idea why this isn't working in crontab?
I can execute the script manually and worked good.
but in crontab it will stop after the first rar command.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top