We help IT Professionals succeed at work.

Check out this week's podcast, "Dairy Farms to Databases: Community's Hand in Technology"Listen Now

x

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

1,122 Views
Last Modified: 2013-12-21
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

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2013
Top Expert 2013
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
oh, many, I've been beatin' my head against the wall for like 7 months on this . . . thanks !
- trying now.

Author

Commented:
worked !

Author

Commented:
bulls-eye, thanks.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.