CRON is not working perfectly


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting CRON is not working perfectly
# 1  
Old 01-17-2008
CRON is not working perfectly

I scheduled a cron job to run @ 1:00 as follows ,
00 01 * * * /app/cbf/CLIF/version-1.0.0.0/scripts/archival.sh

Please find the archival.sh script.

But cron is throwing a mail stating sqlplus command not found
So can anybody suggest what might be the problem ???
# 2  
Old 01-17-2008
Where do you have the definition of the function "execute_sql" used in the script?

If the script is unable to find the location of the sql command then it will throw this error,try giving the full path of the sql.

Are you able to run the script locally ie not from a cron?

Thanks
Nagarajan G
# 3  
Old 01-17-2008
yes i am able to run , standalone this script on my loacl m/c with out any error .

Please the attached script where execute_sql is defined
# 4  
Old 01-17-2008
This because in your script the PATH was not defined.

As you have defined,
Code:
ORACLE_BIN=$ORACLE_HOME/bin  ; export ORACLE_BIN

Code:
function execute_sql
{
db_var="$1"
v_cnt=`$ORACLE_HOME/bin/sqlplus -s $CLIF_DB_USRNM/$CLIF_DB_PWD@$CLIF_DB_NAME << ENDSQL | sed -e "s/Connected\.//" -e "/^$/d"
set pagesize 0 feedback off verify off heading off echo off  serveroutput on size 10000
whenever sqlerror exit 1
--@'$var1'
$db_var
commit;
exit ;
ENDSQL`
db_var=""
}

Please try by providing full path to "sqlplus" command in the execute_sql function as above.

Thanks
Nagarajan G
# 5  
Old 01-17-2008
ok..thanx a lot...i will try this option out...and let u know the status
# 6  
Old 01-17-2008
Java

Quote:
Originally Posted by manas_ranjan
ok..thanx a lot...i will try this option out...and let u know the status
Or you can better try setting the PATH variable in the script where 'execute_sql' function is defined(sqlplus is used).

export PATH="$PATH:$ORACLE_BIN"

This will add the utilities in Oracle home's bin to the path in which it will search when it encounter 'sqlplus' or 'sqlldr'


With Regards
Dileep Pattayath
# 7  
Old 01-17-2008
i just wanna to know...
why the path for oracle/sqlplus needs to set in my coding level of profile values???knowing that these are already there in .profile of that particular user which invokes the cron.

i have added these values just to know that every parameter(global n local) are properly set while running my cron, but of no use ..now i am going to add this PATH variable , let see what happens.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. SuSE

Cron not working

Hi, It is SLES 10.3 VM. Suddenly cron stopped working on this and I am not able to figure out, where it is failing. It is not running with even root. I gave a simple job of redirection of 'date' command, that also doesn't work. Can somebody help me to fix this ? vmprdt23:~ # ps -ef | grep -i... (4 Replies)
Discussion started by: solaris_1977
4 Replies

2. Shell Programming and Scripting

Cp not working in shell script but running perfectly from shell

Dear All, I have script. Dest="" IFS=' ' for translation in $(echo $MY_MAP) do t1=$(echo $translation | cut -d"=" -f1) t2=$(echo $translation | cut -d"=" -f2| cut -d"," -f1) if then Dest=$UNX/$u_product_path/$u_study_path/$UNXTR/$t2 break; ... (4 Replies)
Discussion started by: yadavricky
4 Replies

3. Homework & Coursework Questions

Program run perfectly without error but cant show anything

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: No problem,but it cannot show what I want 2. Relevant commands, code, scripts, algorithms: wc test.cpp wc... (1 Reply)
Discussion started by: guankin
1 Replies

4. UNIX for Dummies Questions & Answers

Cron job not working

cron process in AIX is there when I do ps -ef |grep cron, but none of cron job is working. It appears that cron process is hanging or having some issues? How do you resolve this? Do I kill the cron process by kill -9 PID? and how to start it? Please advise. (1 Reply)
Discussion started by: Daniel Gate
1 Replies

5. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

6. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

7. Solaris

cron not working.

I have a script monitor.sh the path is /netmon/bin/monitor.sh when i run this script as sh /netmon/bin/monitor.sh it runs completely fine. but when i include it in crontab , it does not run my cron entry is 0,5,10,15,20,25,30,35,40,45,50,55 * * * *... (11 Replies)
Discussion started by: asalman.qazi
11 Replies

8. UNIX for Dummies Questions & Answers

Cron not working

I created a file in /u01/oradata directory as cronjb.ksh which contains following script 30 12 * * * /export/home/oracle/u01/oradata/rman.ksh '/export/home/oracle' is my root directory. I then moved cronjb.ksh file to my '/export/home/oracle' directory. i typed crontab cronjb.ksh. However my... (1 Reply)
Discussion started by: manna
1 Replies

9. UNIX for Dummies Questions & Answers

Cron not working?

Hello I have a mac os x server machine that I have setup a cron to run a php file using wget and cron doesn't seem to work. I have setup cron on other mac's before and they have all worked. Also I know wget works because I have tested it. Is there anything else I should try? I do crontab -e and... (5 Replies)
Discussion started by: christo16
5 Replies

10. UNIX for Dummies Questions & Answers

cron not working

Cron does not seem to work with this crontab. Any ideas? # run-parts # commands to execute every hour 01 * * * * root run-parts /etc/cron.hourly # commands to execute every day 02 4 * * * root run-parts /etc/cron.daily # commands to execute every week 22 4 * * 0 root run-parts... (1 Reply)
Discussion started by: DaleCabell
1 Replies
Login or Register to Ask a Question