Problem with Job execution using crontab


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with Job execution using crontab
# 1  
Old 11-10-2011
Problem with Job execution using crontab

Hi All,

I am facing a problem with crontab.I made an entry in crontab like this
Code:
05 07 * * * /afs2/cdwfullacc/current/exe/cdw_generate_special_klant.sh > /afs2/cdwfullacc/current/scratch/cdw_gen_cron.log

But job was not getting executed.

Entry in crontab was made with same user by whom file was created.

I checked file rights , it has execute permissions. i changed permission to 777 also.

I see that log file is getting created but of size 0.

I also checked with below options like
Code:
1) 04 18 * * * sh /afs2/cdwfullacc/current/exe/cdw_generate_special_klant.sh > /afs2/cdwfullacc/current/scratch/cdw_gen_cron.log
2) 04 18 * * * /usr/bin/sh /afs2/cdwfullacc/current/exe/cdw_generate_special_klant.sh > /afs2/cdwfullacc/current/scratch/cdw_gen_cron.log

but eventhen job was not getting executed.

Kindly help me .

Regards
Krishna

Moderator's Comments:
Mod Comment Please use code tags <- click the link!

Last edited by zaxxon; 11-10-2011 at 05:59 AM.. Reason: code tags, see PM
# 2  
Old 11-10-2011
what is your cron log says ?
check in /var/log/
# 3  
Old 11-10-2011
Yes, i checked in log file. it states
/afs2/cdwfullacc/current/exe/myscript.sh: sqlplus: execute permission denied

Here is my script
Code:
LOGSQL=xyz\$app1
PASSWORDSQL=mypass\@applicaiton.ptt.nl

last_hour=`sqlplus -s $LOGSQL/$PASSWORDSQL << EOF
           set sqln off
           set feed off
           set head off
           select substr(file_name,70,2) from (select file_name from table1 order by file_name desc) where rownum=1;
exit;
EOF`

echo "welcome $last_hour" | mail xyz@abc.com

Now the problem is when this script is executed at command prompt, it executes. But when scheduled, it gives above error.

Query will retrieve value 17.

Kindly help me


Moderator's Comments:
Mod Comment Please use code tags <- click the link!

Last edited by zaxxon; 11-10-2011 at 05:59 AM.. Reason: code tags, see PM
# 4  
Old 11-10-2011
check your oracle binaries are owned by oracle user and having the execute permission.

Also you need to export the oracle variables in your .profile file.

search in this forum and google, you will get the steps for this problem
# 5  
Old 11-10-2011
In the link below you will find all Oracle environment variables:
-----> Managing Unix environment variables | Oracle FAQ
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execution problem with CRON job

HI, I have written an executable file in unix and I was able to execute it successfully but when I called this file with cron job it was giving error like "permission denied" and "No such file or directory". Please help in how cron calls the file and what permission is required on the file... (2 Replies)
Discussion started by: vipin kumar rai
2 Replies

2. HP-UX

Crontab Execution

Hi Guys, I need help to clear my doubt w.r.t Crontab execution. uname -a HP-UX myservername B.11.31 U ia64 1422528451 unlimited-user licenseI created a crontab entry to execute particular job on Saturday 11/15/2014 11:22 Below is the cron entry #refresh DEVDB from PRODDB 22 11 15 11 6... (6 Replies)
Discussion started by: rocky.community
6 Replies

3. Shell Programming and Scripting

Crontab job scheduler problem

Dear All. I have a scripts which does many task like house keeping, moving file to different location and loading the data into oracle. I run this scripts daliy manually , I decided to put it into cron. I have put the scripts into crantab but the behaviour of the scripts have changed. it... (2 Replies)
Discussion started by: guddu_12
2 Replies

4. UNIX for Dummies Questions & Answers

Problem with Crontab execution

Hi I have shell script to excute the SQL script.And i have scheduled those shell script in crontab.But the Shell script is not running timely and i got the below error Crontab entry 15 05 17 7 * /export/home/vcpsapp/vcps/stat.sh Output Your "cron" job on uspxivus16... (3 Replies)
Discussion started by: mak_boop
3 Replies

5. Shell Programming and Scripting

Parallel Job Execution

Hi All, At present I am using a UNIX Script which is running a set of JOBS. These JOBS are to be repeated for 20 times, means the same set of JOBS are repeated by just passing different arguments (From 1 to 20). Is there any way by which I can execute them parallel? At present its all... (4 Replies)
Discussion started by: Prashantckc
4 Replies

6. Solaris

Solaris 10.5 perl and cron job execution problem

Hi, I want to run a crontab job on solaris 10.5. I have configured the crontab accordingly 10 * * * * /scripts/dbalter.pl >> /scripts/cronout.txt However this does not work .Then I go to /var/mail/root and find an error in the output: From root@myserver Wed Feb 4 17:02:00 2009... (1 Reply)
Discussion started by: sonu2die4
1 Replies

7. UNIX for Dummies Questions & Answers

Confirm job execution

Hello everybody, Can anybody tell me how do we comfirm the execution of a scheduled job ? In other words, how do I know whether my scheduled script is being executed or not ? Thanks Jitu JK (2 Replies)
Discussion started by: jitu.jk
2 Replies

8. Shell Programming and Scripting

crontab execution

is it possible to soecify time overnight in 5 days for example: 0 18-7 * * 1-5 /mycode is this okay to use 18-7 because im not getting the results correctly? (4 Replies)
Discussion started by: vadharah
4 Replies

9. UNIX for Advanced & Expert Users

Job execution through Xming

Hello, Every evening I run few shell scripts on AIX Production Box, One shell script takes about one hour to complete and does some DB updation and application processing etc. The shell scripts are getting launched from prompt and not through cron or any scheduler as they require some manual... (0 Replies)
Discussion started by: panchpan
0 Replies

10. UNIX for Advanced & Expert Users

Run crontab job problem

I hv a crontab job (script) that can be run normally , now I try to run it on the shell but can't be run , can advise what is difference between run a script on crontab and run it manually ? is it the difference of system enviornment ?thx I tried to fix it by below method , I write a script... (3 Replies)
Discussion started by: ust
3 Replies
Login or Register to Ask a Question