Crontab job scheduler problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Crontab job scheduler problem
# 1  
Old 11-05-2012
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 moves the files as it has been coded but donot call oracle loader to load the data. when running manually it can do all the work as per the code.

Any clue please
# 2  
Old 11-05-2012
Most of the problems with crontab execution are related to the differences between the interactive and non-interactive environment.
Try adding the PATH and/or the other related variables present in your initialization files (profile and rc files) in the failing shell script explicitly.
# 3  
Old 11-05-2012
Advice: Always use the whole path to a command in the cron and the script the cron calls.

When calling a particular command, let's say grep, always give it the whole path to the command.

grep is a good example of this because there are multiple versions of it installed on most systems and each as different commandline switches.

Typically when this is the case the man page for that utility in question will give you the whole path of each version. As an example, here is the first portion of the man page in Solaris for the grep Utility:

Code:
/usr/bin/grep [-bchilnsvw] limited-regular-expression 
     [filename]...

/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvx] -e pattern_list... 
     [-f pattern_file]... [file]...

/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvx] 
     [-e pattern_list]... -f pattern_file... [file]...

/usr/xpg4/bin/grep [-E | -F] [-c | -l | -q] [-bhinsvx] pattern 
     [file]...

As you can see there are two different versions available, and depending on which one you call, you have different options on how to use it.

Also, please note that only one of these is, by default, in you're path so if you want to use the other, more powerful, version (the one in user/xpg3/bin) you have to call it by the whole path. Especially when scripting with it.

Hope this helps,
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Crontab scheduler to execute script every 45 days

Can someone please help me on how to schedule script to run every 45 days in crontab ? Thanks, Prince (5 Replies)
Discussion started by: prince1987
5 Replies

2. UNIX for Advanced & Expert Users

Autosys Scheduler- Running job at particular time

Hi Experts, I am new to Autosys. I created a Autosys box job to run at 10 AM daily. As scheduled, the job starts on time. There is another box job inside the box. I have scheduled it to run at 11 AM but it kicks off automatically with the main job at 10 AM. insert_job: Main-job ... (2 Replies)
Discussion started by: pk_bohra
2 Replies

3. Shell Programming and Scripting

Help needed regarding cron job scheduler with CyberArk Password security

Hi All, I have a script which will restart some web server and bring it up again. For that I need to retrieve 3 password from CyberArk (Cyber-Ark - Wikipedia, the free encyclopedia) vault. My question is: Is this possible to schedule the script through cron and automatic password... (0 Replies)
Discussion started by: saps19
0 Replies

4. Shell Programming and Scripting

Problem with Job execution using crontab

Hi All, I am facing a problem with crontab.I made an entry in crontab like this 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... (4 Replies)
Discussion started by: krishna_gnv
4 Replies

5. UNIX for Dummies Questions & Answers

CRON JOB SCHEDULER throwing "option not allowed error"

Hi All, Pardon me if this turns out to be a dumb question. But I am trying to schedule a cron job for a my script which takes input options. So an entry in crontab would be something like: 1 * * * * run_report.sh -o out.csv -m monthly -e somename@email.com > cron_output.log 2> cron_error.log... (3 Replies)
Discussion started by: trueharsh
3 Replies

6. UNIX for Dummies Questions & Answers

Script ran by job scheduler fails from the 15th to the 20th of the month

Hi, I have a script that finds the application logs from the previous day and sends it to another server via ftp. The code is something like this: yest_date=`TZ=CST+24 date "+%b %d"` logdir=/app/logs logs=app*.log tmpdir=/tmp cd $logdir for i in `ls -1 $logs` do chkstr=`ls -1l $i | grep... (2 Replies)
Discussion started by: tatchel
2 Replies

7. 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

8. Shell Programming and Scripting

Job scheduler without using cron

Hi, I want to schedule the scripts/batches to run simultaneously. I had all the information in the config (flat)file, which contains script name, time, dependency, path, priority and status etc., I want to run the jobs parellelly and some jobs are required to give the input. How can I do this?... (1 Reply)
Discussion started by: sharif
1 Replies

9. UNIX for Advanced & Expert Users

Job Scheduler Agent-Based.

Hi Gurus, I'm looking for a real Jobs Scheduler Agent-based. My customer is using cron, but need something a little bit clever, where you could configure chain of process ("script x will run if script y is finished", etc). Of course I know solutions like control-M (from BMC... (1 Reply)
Discussion started by: maquinte
1 Replies
Login or Register to Ask a Question