Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > General
User Name
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!


Closed Thread
  Search this Thread
Old 10-13-2004, 06:25 AM   #1
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 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

Old 10-14-2004, 11:27 AM   #2
LQ Guru
Registered: Jan 2001
Posts: 24,147

Rep: Reputation: 229Reputation: 229Reputation: 229
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:

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 10:24 AM
Perl shell-out to script dunna work. Works on command line. Why? jlangelier Linux - Software 1 08-28-2004 03: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 07:40 PM
instant message form command line jonfa Linux - General 4 03-10-2004 10:45 PM
shell script form submit precioso77 Linux - General 2 05-18-2003 12:50 PM

All times are GMT -5. The time now is 05:01 PM.

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