Page 1 of 1
Running Script through Execute Command Activity
Posted: Fri Nov 07, 2008 9:16 pm
by ravij
Hi,
I want to run the Unix shell script using Execute Command Activity in Sequence job. I have given the command in Command box like
sh -c ". /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh"
But Seq job got aborted. My question is: Is that command incorrect? or the way I defined bothe command and file path in the same Command box is incorrect?
I searched in the forum but could not get required solution.
Please tell me how to run the script
Thanks in advance.
Posted: Fri Nov 07, 2008 9:27 pm
by ray.wurlod
Leave out the sh -c and the double quotes.
Posted: Sat Nov 08, 2008 12:23 am
by chulett
And the dot. If you still have problems, post the actual error(s) - simply saying it "got aborted" doesn't really help us help you.
Posted: Sat Nov 08, 2008 5:47 am
by ravij
Hi Ray/Hulett,
Thanks for your reply.
The job got aborted even I changed the command as
. /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh)
The error message I got is
22:17:33: Execute_UANZ (COMMAND . /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh) started
22:17:33: Execute_UANZ finished, reply=1
22:17:33: Stop_Run Executed
22:17:33: Sequence terminated
Should there be space between the Dot(.) and / or not?
Please help to resolve this issue.
Your help would be appreciated.
Posted: Sat Nov 08, 2008 5:50 am
by ravij
The job got aborted even I changed the command as
. /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh
The error message I got is
22:17:33: Execute_UANZ (COMMAND . /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh) started
22:17:33: Execute_UANZ finished, reply=1
22:17:33: Stop_Run Executed
22:17:33: Sequence terminated
Should there be space between the Dot(.) and / or not?
Please help to resolve this issue.
Your help would be appreciated.
Posted: Sat Nov 08, 2008 5:57 am
by ray.wurlod
The problem is in your script, which exits with a status of 1. DataStage assumes that a non-zero exit status is a failure, since this is the convention followed in all shells. If you want to make sure that this does not occur, make sure that your script exits with a zero status if the script does not encounter any errors. Usually exit 0 is sufficient (controlled by appropriate logic, of course).
Posted: Sat Nov 08, 2008 6:24 am
by ravij
Thanks a lot Ray.
You are correct my script exits with status of 1. I will change it as 0 and run the job again. If change 1 as 0, will it impact on script?
Thank you once again.
Posted: Sat Nov 08, 2008 8:35 am
by chulett
What is your script doing? Is there a significance to the return code of '1'? As noted, the convention is a zero to indicate success and a non-zero return to indicate a problem. Typically.
Only you can tell us what 'impact' the change of exit status would mean, seeing as how we have no clue what you are doing in it.
Posted: Sat Nov 08, 2008 11:42 am
by lstsaur
Ravi,
Code like the following:
/u6/app/datastage751/dwhsetld/invoice/scripts/./stg_invdisct_ods_load_uanz.sh
Posted: Sat Nov 08, 2008 2:54 pm
by chulett
Why?
Nothing wrong with simply a full path to the script:
Code: Select all
/u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh
Or were you going for something like this?
Code: Select all
cd /u6/app/datastage751/dwhsetld/invoice/scripts/ && ./stg_invdisct_ods_load_uanz.sh
Posted: Sat Nov 08, 2008 4:17 pm
by rameshrr3
You can use sh-c in the command box and the rest of the script in the arguments box
Posted: Sat Nov 08, 2008 5:30 pm
by lstsaur
Craig,
Absolutely agree with your statements. What I was trying to tell Ravi that either code as
/u6/app/datastage751/dwhsetld/invoice/scripts/./stg_invdisct_ods_load_uanz.sh
or
. /u6/app/datastage751/dwhsetld/invoice/scripts/stg_invdisct_ods_load_uanz.sh
will work since he asked whether he should put a / after the . or not.
Posted: Sat Nov 08, 2008 6:23 pm
by chulett
Ah... ok. My advice earlier on was to forget the dot but if for some reason it has got to be in there somewhere, that's
two somewheres.