script execute by cron problem, but manual ok


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting script execute by cron problem, but manual ok
# 1  
Old 05-30-2007
script execute by cron problem, but manual ok

Hi;

I'm facing the problem with my script like below

30 0 * * * /data/SCRIPT/LOADLOGS/loadata1.sh 2 1 >> /tmp/loaddata.txt

loadata1.sh calling a another 2 scripts which we need to exe in sequence.
when it perform by cron jon, sometimes it just can process 20 recs or less or nothing but when we re-run each scripts manually, it found 100 recs.

anyone has an experience before ? is it because of the cron or the script itself ? but we execute exactly the same script for both by cron or manual.

pls help... thanks in advance
# 2  
Old 05-30-2007
look into this FAQ
# 3  
Old 05-30-2007
1. The executing user should get emails if any stdout or stderr was produced.

And in the environment your script runs (exec'd by cron and with minimal environment).....

2. check your paths (PATH, LD_LIBRARY_PATH etc)

3. check your environment
# 4  
Old 05-30-2007
just little bit confused..

if the env or path problem, my cron should unable to process at all any recs,
am i right ??
but it seems like inconsistent problem..


Quote:
Originally Posted by porter
1. The executing user should get emails if any stdout or stderr was produced.

And in the environment your script runs (exec'd by cron and with minimal environment).....

2. check your paths (PATH, LD_LIBRARY_PATH etc)

3. check your environment
# 5  
Old 05-30-2007
Quote:
Originally Posted by izai
if the env or path problem, my cron should unable to process at all any recs,
am i right ??
We don't know what's in your script.
# 6  
Old 05-31-2007
our script quite complicated to explain in here.. anyway.. thanks for the reply, will check on the env and path, etc.
# 7  
Old 06-01-2007
write a full path of the script which u have called.. then it ok...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need assistance to define path on a script which cron will execute

I have written a script to execute some sql statement via executable file. It is working fine via command line, however when I schedule it in cron. The executable file is looking for library file in its root directory. Wonder where does cron run the script from, and can we get the script... (4 Replies)
Discussion started by: jaapar
4 Replies

2. UNIX for Dummies Questions & Answers

Execution problem with Cron: Script works manually but not w/Cron. Why?

Hello gurus, I am making what I think is a simple db2 call from within a shell script but I am having difficulty producing the desired report when I run the script shown below from a shell script in cron. For example, my script and the crontab file setup is shown below: #!/bin/ksh db2... (3 Replies)
Discussion started by: okonita
3 Replies

3. Shell Programming and Scripting

How to check if script is run via cron or manual=command line?

Hi all, I have a script that can be run via cron or via the command line. Is there any way that I can place something on the script to be able to distinguish/differentiate whether the script was run via a user in the command line or whether it was run from the cron? (3 Replies)
Discussion started by: newbie_01
3 Replies

4. Solaris

cannot execute sqlplus in shell script under cron

Hi, I have a bourne shell script that needs to login into sqlplus and execute a stored procedure. I need this shell script to be run under a user crontab. It works fine if run under normal shell prompt. But it gave error message in my log file when run under crontab: SQL*Plus: Release... (4 Replies)
Discussion started by: joe_x
4 Replies

5. HP-UX

Manual vs Cron execution in HP-UX

Below is a simple script that will find the path were the perl command reside. ========================= #!/usr/bin/sh nPerl=`which perl 2>>/dev/null|grep -v "no perl"` if ; then echo "No Perl application exist..." else echo "Existing at $nPerl" fi ========================= When I... (2 Replies)
Discussion started by: padi
2 Replies

6. Shell Programming and Scripting

Difference between using shell or cron to execute a script

Hi! Maybe i am here in the wrong section for the problem, but let me try to explain. I have the following simple backup script, as a solution till the final backup solution is online. Unfortunatly it will only work when executed manually. When i set up a cron job to execute the script, only the... (4 Replies)
Discussion started by: locutus01
4 Replies

7. Solaris

anomalous behaviour when I execute the script via cron

Hi , I am having a strange problem with my cron job : here is the script that I am scheduling from cron WrapperScript.ksh #!/bin/ksh ########## Global Variables ########## DATE=$(date +"%b-%d-%y") TIME=$(date +"%H:%M") LOGFILE=sonar_execution_$DATE.log ########## Main Processing... (2 Replies)
Discussion started by: alookachaloo
2 Replies

8. Shell Programming and Scripting

cron does not execute script properly

I have a simple script that checks for certain printers and records them to a file. When I run the script manually at the command prompt, it works perfect, but when I run the script via cron, nothing happens. No errors reported, and no records are written out. I'm using Solaris 10. Below is the... (4 Replies)
Discussion started by: lmatlebyane
4 Replies

9. UNIX for Dummies Questions & Answers

a cron job needs a perl script to execute

Hello evreyone, this is my first post, and to say i'm new to this is an understatement. I know very little about perl scripts and hope some one can help me. i'm looking to get a script that a cron job can execute. what the script needs to to is 1) connect to a mysql database 2) go to a... (2 Replies)
Discussion started by: Exader
2 Replies

10. AIX

problem with a script and the cron

hello I use a script to give me the number of users, at each hour. this script read a file where there is the number of users for each hour and for each month (so 12 files per year). If i execute the script (root), it is ok, i have xxx users for each hour. if I put the script in the cron... (1 Reply)
Discussion started by: pascalbout
1 Replies
Login or Register to Ask a Question