unable to schedule job in cron


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting unable to schedule job in cron
# 1  
Old 01-14-2009
unable to schedule job in cron

Hi,

from normal user(oracle) i am unable to run scheduled job in cron:
os version:
bash-2.03$ uname -a
SunOS sumail02 5.8 Generic_117350-39 sun4u sparc SUNW,Ultra-60

bash-2.03$ crontab -l
55 * * * * sh /oracle/statistics.sh > /dev/null 2>&1
bash-2.03$ cat /oracle/statistics.sh
/oracle/bin/svrmgrl << EOF
connect inventory/inventory;
set serveroutput on size 900000
spool /oracle/tablesanalyze.txt
execute GATHER_STATS;
spool off
EOF

if i run manually the .sh file it will run and if i scehdule in cron it won't run:


error is :
bash-2.03$ cat tablesanalyze.txt
BEGIN
*
ORA-03114: not connected to ORACLE


is something i missed.

helpfull is appreciated:


Thanks

Prakash
# 2  
Old 01-14-2009
When you run the job manually, you'll be using all of the environment set up in your profile. When the job runs under cron, that profile's not there.
Three choices...
Source your profile in cron...
Quote:
55 * * * * ./<your_home_path/.profile; sh /oracle/statistics.sh > /dev/null 2>&1
Source your profile in the script
Quote:
./<your_home_path/.profile
/oracle/bin/svrmgrl << EOF
connect inventory/inventory;
set serveroutput on size 900000
.
.
Or just add the required environment variables to the script...
Quote:
export ENV_VARIABLE=<Path>
etc
.
.
/oracle/bin/svrmgrl << EOF
connect inventory/inventory;
set serveroutput on size 900000
.
.
HTH

Jerry
# 3  
Old 01-14-2009
Hi JerryHone,


Thanks for your inputs and it worked for me.


Cheers

Prakash G R
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Cron job is not running on schedule

Scheduled job is not running on time.but it is running when executing same command manually. 25 10 * * * /code/bin/ACCOUNT.ksh 1 >/dev/null 2 >&1 Manually executing the same Ksh -x /code/bin/ACCOUNT.ksh 1 >/dev/null 2 >&1 Followed steps Crontab -e Added the job to cron tab. (4 Replies)
Discussion started by: Myguest
4 Replies

2. Shell Programming and Scripting

schedule a job without Cron

Hi All, Is there any way (any utility) to schedule a job to run once in a week on RedHat Linux ? Note- Do not using Crontab. Thanks Pravin (1 Reply)
Discussion started by: pravin27
1 Replies

3. UNIX for Dummies Questions & Answers

Schedule a cron job

Hi, Can anyone help me out with scheduling a cron job for the below: i wnated to delete file from a folder on every sunday at 05:00 AM this is code i have used. ******************************************************* 0 05 * * 0 find /abc/xyz/pqrs/bak/ -type f -mtime +30 -exec rm -f... (5 Replies)
Discussion started by: ch33ry
5 Replies

4. Shell Programming and Scripting

Schedule a Cron job

Hi all, I am new to cron jobs.. i wanted to schedule a cron job that wil send a mail to me at 3:00PM on 10th August ie is on Wednesday. 0 15 10 8 3 echo "message from UNIX here"|mail -s "your subject here" user@user.com However this was not executed... Can anyone please... (0 Replies)
Discussion started by: ch33ry
0 Replies

5. Shell Programming and Scripting

Cron to schedule job at different times

Hi, I want to run cron scheduler to run some script at different times of the day.But these times don't have some fix intervals. So how we can run jobs at 6:30AM, 1:00PM and 4:30PM everyday. Please help. Thanks Neeraj (2 Replies)
Discussion started by: apjneeraj
2 Replies

6. Shell Programming and Scripting

unable to schedule in cron

the follwing script is running fine , when run from the ksh shell...it runs properly i.e. waits for a file "test.flag" and sends mail accordingly. But when I schedule it in the crontab ...it does not run at the specified time (it never runs). I am using ksh ####shell script starts count=1... (4 Replies)
Discussion started by: ace@123
4 Replies

7. Shell Programming and Scripting

How to Schedule job using cron(URGENT)

Hello All, I m newbie to Job scheduling. Suppose i have 2 files s1.sh and s2.sh i want to make a schedule such as run s1.sh at 2AM everyday and run s2.sh 9Pm everyday. Can anyone tell me how to schdule that using CRON and i want to know what is CRON and CRONTAB. Thanks in advance (2 Replies)
Discussion started by: ravi.sadani19
2 Replies
Login or Register to Ask a Question