Execute Command - Shell script execution error

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Execute Command - Shell script execution error

Post by prasad111 »

Hi

I am executing a shell script from Execute command stage.
In General Tab --> Stage name
In Exec Command --> I have the unix path and the shell script
(/inbound/scripts/abc.sh)

That is the only stage I am using in the sequencer, when I run this I am getting the error like

JobControl (@Execute_Command_46): Command /inbound/scripts/abc.sh did not finish OK, reply = '127'
.JobControl (@Execute_Command_46): Controller problem: Unhandled failure (127) encountered executing command /inbound/scripts/abc.sh
--
Seq_Test1..JobControl (@Coordinator): Summary of sequence run
08:44:16: Sequence started (checkpointing on)
08:44:16: Execute_Command_46 (COMMAND /inbound/scripts/abc.sh) started
08:44:16: Execute_Command_46 finished, reply=127
08:44:16: Exception raised: @Execute_Command_46, Unhandled failure (127) encountered executing command /inbound/scripts/abc.sh
08:44:16: Sequence failed (restartable)
---
Seq_Test1..JobControl (fatal error from @Coordinator): Sequence job (restartable) will abort due to previous unrecoverable errors

------------------------------------------------------
Please guide me what is this error and how can I fix this error

Regards
Prasad
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You have 'Automatically handle activities that fail' turned on and your command did not return a zero result - so it was considered to have failed.

Either turn off that option or read in the Help how to use two triggers to convince the Sequence job that you are handling the 'failure'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Post by prasad111 »

chulett wrote:You have 'Automatically handle activities that fail' turned on and your command did not return a zero result - so it was considered to have failed.

Either turn off that option or read in the Help how to use two triggers to convince the Sequence job that you are handling the 'failure'.
Thanks for the quick reply

I made the changes as you said (turn off that option 'Automatically handle activities that fail' ),
(1) Problem 1: I am still get the warning like this
Seq_Test1..JobControl (@Execute_Command_46): Command /inbound/scripts/abc.sh did not finish OK, reply = '127'
(2) Problem 2: one of the script ran succesfully with the warning above mentioned. I was running another script def.sh from ExecuteCommand stage, inside the script I am calling a small script that is not getting executed, does DS supports this type of operation.

Regards
Prasad
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Handle all errors inside your script and exit explicity using a return code of 0 for successful and 1 unsuccessful.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

prasad111 wrote:(1) Problem 1: I am still get the warning like this
Seq_Test1..JobControl (@Execute_Command_46): Command /inbound/scripts/abc.sh did not finish OK, reply = '127'
You will because your script sent a return code that is non-zero. All you did was turn off the fact that the job should automatically abort because of that. It should echo out whatever information you are trying to capture and send a return code of zero to indicate it was successful. Then check for Command Output in your Sequence.
-craig

"You can never have too many knives" -- Logan Nine Fingers
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Post by prasad111 »

DSguru2B wrote:Handle all errors inside your script and exit explicity using a return code of 0 for successful and 1 unsuccessful.
Yes I am using the return code
[#parameters declatation

-
=
script continues
-------
when I am executing outside DS Job(UNIX command prompt) it executes fine, when I execute from Exec Command stage it creates a file FTPfile.list with 0 lines, it was suppose to get 20 lines

Please let me know if I have interpret your reply correctly, suggest me if I am doing something wrong
Regards
Prasad
Last edited by prasad111 on Tue Jun 19, 2007 10:02 am, edited 1 time in total.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I hope you are initializing all the variables ($) inside your script. The script looks ok. Post your entire script please.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Post by prasad111 »

DSguru2B wrote:I hope you are initializing all the variables ($) inside your script. The script looks ok. Post your entire script please.
Main Script

Code: Select all

#!/bin/ksh

###############################################################################

Last edited by prasad111 on Tue Jun 19, 2007 10:02 am, edited 1 time in total.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

At a glance the scripts look fine. Just make sure that both scripts have permission to be executed by your datastage id.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Post by prasad111 »

DSguru2B wrote:At a glance the scripts look fine. Just make sure that both scripts have permission to be executed by your datastage id.
It looks like this

-rwxrwxrwx 1 atgr atgr 1239 Mar 9 16:38 filelist.sh
-rwxrwxrwx 1 atgr dstage 2478 Mar 12 09:51 Extract.sh

Extract is the main script and filelist.sh is the script called from the main script

do I need to change anything here, if yes plese let me know the command for it

thanks a lot
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Well the permissions look fine. I am running out of ideas now. I guess its upto you. Put a bunch of echo statements in both your scripts. These statements will show up in the log. See how far it goes without breaking.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
prasad111
Premium Member
Premium Member
Posts: 173
Joined: Fri May 19, 2006 10:53 am

Post by prasad111 »

DSguru2B wrote:Well the permissions look fine. I am running out of ideas now. I guess its upto you. Put a bunch of echo statements in both your scripts. These statements will show up in the log. See how far it goes without breaking.
The path names had some problem.
a2love
Participant
Posts: 30
Joined: Fri Feb 09, 2007 10:03 am

Post by a2love »

sidenote: posting ftp loc, user, and password may not be a great idea for sensitive data... and if its fake good on ya :wink:
Adam Love
Post Reply