troubleshooting Question

Unix script fails when called from CA-7 scheduler but runs when kicked off manually

Avatar of Alaska Cowboy
Alaska CowboyFlag for United States of America asked on
Shell ScriptingUnix OSSystem Programming
4 Comments1 Solution1134 ViewsLast Modified:
I have a script that calls two other scripts.

When I run the script manually, it works fine. But when I run it from CA-7 scheduler, it doesn't work.

In the script below, I thought that for sure when I changed this:
./call_cdr_load.sh $this_source PRD
to this:
./slice6/imedw/dev_non_compile/call_cdr_load.sh $this_source PRD

I would be good to go, the thought being that when the job is run from CA-7, I need to specify the full path to the job.

When I run it manually (like this ./call_cdr_load.sh $this_source PRD) I am sitting in the proper directory where the .sh script resides.

Here is the output when running from CA-7
Now running driver for Product CDR Loader script
process started on Wednesday, July 07, 2010 12:41:51
source = 075
Calling cdr_loader script at Wednesday, July 07, 2010 12:41:51
Analysis started on Wednesday, July 07, 2010 12:41:51   <------------ so "cdr loader" ran in "0 seconds"
Integrations started on Wednesday, July 07, 2010 12:41:51  <------------- Analysis also ran in "0 seconds"
Product CDR load process completed  on Wednesday, July 07, 2010 13:31:05

Here is the output when I run it manually:
Now running driver for Product CDR Loader script
process started on Wednesday, June 30, 2010 17:19:52
source = 075
Calling cdr_loader script
Calling analysis script
Analysis started on Thursday, July 01, 2010 02:24:02  <-- so cdr_loader ran ~9 hours
Calling Integrations
Integrations started on Thursday, July 01, 2010 03:50:45 <--- Analysis ran ~90 minutes
Product CDR load script completed
CDR load process completed  on Thursday, July 01, 2010 04:55:55

So to debug this, and really stumped, I've worked with several other admins here to no avail.
"load_cdr_prd_tables.ksh" 97 lines, 2649 characters 
#!/usr/bin/sh
####
# Program Name: load_cdr_prd_tables.ksh
# Author: W. Peck
# Created: Nov 2009
# Purpose: Execute various jobs at month-end to load Product to CDR
#       - load to CDR
#       - run Analysis (no user e-mail), prior to Integrations
#       - run Integrations
#               if all all approved, the status is set to cdr approved and then the final analysis is run
#               - this is done through the Integration process, not here directly
#
####
#
# Set up Unix Trace
#
set -x

this_source=$1
dateparm=`date "+%d-%b-%Y-%T"`

#
# Set up Oracle environmental variables
#
export ORACLE_SID=edwdev02
ORAENV_ASK=NO
. oraenv
ORAENV_ASK=

#
export output_dir=/slice6/imedw/transforms/product/facets/oldfiles

#remove prior oracleTrail_CDR
rm $output_dir/oracleTrail_CDR

# start Oracle trail
echo "Now running driver for Product CDR Loader script" >> $output_dir/oracleTrail_CDR
echo | date "+process started on %A, %B %d, %Y %T" >> $output_dir/oracleTrail_CDR
echo "source = $this_source" >> $output_dir/oracleTrail_CDR

# Call CDR loader
#
echo | date "+Calling cdr_loader script at %A, %B %d, %Y %T" >> $output_dir/oracleTrail_CDR
./slice6/imedw/dev_non_compile/call_cdr_load.sh $this_source PRD

time_start=`date "+%x %X"`

# run Analysis (without sending an e-mail)
#
echo | date "+Analysis started on %A, %B %d, %Y %T" >> $output_dir/oracleTrail_CDR
./slice6/imedw/dev_non_compile/analyze_EDW_subj_area_no_usermail.ksh PRD


#!/usr/bin/sh
####
# Program Name: load_cdr_prd_tables.ksh
# Author: W. Peck
# Created: Nov 2009
# Purpose: Execute various jobs at month-end to load Product to CDR
#       - load to CDR
#       - run Analysis (no user e-mail), prior to Integrations
#       - run Integrations
#               if all all approved, the status is set to cdr approved and then the final analysis is run
#               - this is done through the Integration process, not here directly
#
####
#
# Set up Unix Trace
#
set -x

this_source=$1
dateparm=`date "+%d-%b-%Y-%T"`

#
# Set up Oracle environmental variables


   if [ "$?" -ne 0 ]
   then
      echo "\n****ERROR: Errors encountered while calling integrations !\n" >> $output_dir/oracleTrail_CDR
   fi

# Finish job (integrations above is the last step)
echo | date "+Product CDR load process completed  on %A, %B %d, %Y %T" >> $output_dir/oracleTrail_CDR

# Copy oracleTrail_CDR with datestamp
mv $output_dir/oracleTrail_CDR $output_dir/oracleTrail_CDR_$dateparm
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros