LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices

Closed Thread
 
Search this Thread
Old 10-13-2004, 05:25 AM   #1
saifee
LQ Newbie
 
Registered: Oct 2004
Location: karachi
Posts: 3

Rep: Reputation: 0
Cool shell script works form command line but not form crontab


i am learning linux and shell scripting , i install 9.2.0.1.0 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 )exp.sh as below and save the script in
/home/oracle/shellprog/ directory.

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

when i execute the exp.sh script form command line its works fine

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

15 4 * * * /home/oracle/shellprog/exp.sh

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 exp.sh 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 exp.sh (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

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/home/oracle/shellprog:/u02/app/oracle/product/9.2.0.1.0/bin:/home/oracle
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
20 13 * * * oracle /home/oracle/shellprog/login.sh 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

saifee
 
Old 10-14-2004, 10:27 AM   #2
trickykid
Guru
 
Registered: Jan 2001
Posts: 24,133

Rep: Reputation: 197Reputation: 197
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.

http://www.linuxquestions.org/rules.php

Other original thread found here: http://www.linuxquestions.org/questi...hreadid=241653
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
my database export shell script run from command line but not form crontab saifee Linux - General 11 01-29-2012 09:24 AM
Perl shell-out to script dunna work. Works on command line. Why? jlangelier Linux - Software 1 08-28-2004 02:00 AM
how do I copy a whoel folder form one directory to another form the command line? zwyrbla Linux - Newbie 8 08-24-2004 06:40 PM
instant message form command line jonfa Linux - General 4 03-10-2004 09:45 PM
shell script form submit precioso77 Linux - General 2 05-18-2003 11:50 AM


All times are GMT -5. The time now is 04:31 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration