Logging the output of orchadmin command

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
sprane01
Participant
Posts: 8
Joined: Mon Aug 15, 2011 4:56 pm

Logging the output of orchadmin command

Post by sprane01 »

I have a script on linux which deletes datasets using orchadmin command. Requirement - To be able to see the execution of orchadmin in a log file as we do if the script is executed on command prompt or even if orchadmin is executed directly on the prompt.

Issue:- the script runs in test environment but fails in PERF. It is most likely related to the userid settings but need to capture it in log file.

I have the following code in my script

orchadmin rm -f "*.ds" >> Logfile 2>&1 . It works fine when the delete is successful but if the delete failed its not writing anything into this logfile.

If i run just orchadmin rm -f "*.ds" on the command prompt I can clearly see from the message what the underlying issue is. Need the same error message in a log file. Any pointers?
nagarjuna
Premium Member
Premium Member
Posts: 533
Joined: Fri Jun 27, 2008 9:11 pm
Location: Chicago

Post by nagarjuna »

Failing means what ? What exactly is the error message you are getting in case of no redirection into log & error files . Ideally 1>logfile 2>errorfile should redirect standard o/p into logfile & standard error into errorfile .
Nag
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

The syntax is correct. I have tried it and it writes the error messages into a log file. Maybe you don't have correct path or permissions on your log file.
Choose a job you love, and you will never have to work a day in your life. - Confucius
sprane01
Participant
Posts: 8
Joined: Mon Aug 15, 2011 4:56 pm

Post by sprane01 »

I have put an echo statement before and after the orchadmin like

echo "attempting to delete file x"
orchadmin rm -f "*.ds" >> log 2>&1
status=$?
if [ $status -eq 0 ]
then
echo "delete successful" >>log
else
echo "delete failed" >>log
fi

In case of success i.e. when the dataset is deleted it writes orchadmin execution deletes plus the echo "delete successful" in the log but when it fails to delete its just writing the "delete failed" in the log file. So the reason for delete is unknown.
sprane01
Participant
Posts: 8
Joined: Mon Aug 15, 2011 4:56 pm

Post by sprane01 »

there is a typo..

success - writes orchadmin exec details + echo statements
failure - only echo statements.

Noticed this is happening only for orchadmin commands. Is writing error messages correctly for other unix commands.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Maybe it's your linux shell acting strange. Are you starting your script with any first line such as #! /bin/ksh

Have you tested redirecting standard error into a file from any other command to compare results?

I did try this on AIX using ksh and it worked as it should, with orchadmin standard error output captured in a log file using the syntax you gave.

Have you tested orchadmin errors into a file directly from the command line vs. from a script?
Choose a job you love, and you will never have to work a day in your life. - Confucius
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

So this one is odd...

Sprane01 and I sat down today (I'm one of her admins) and here's the current head scratcher:

as DSUSER, after sourcing dsenv and setting apt_config_file and apt_grid_config, the orchadmin command (alone) returns the proper "here's the syntax ..." text.

When entering "orchadmin rm" it returns nothing.
Switch to dsadm and "orchadmin rm" returns the expected text of "file not found..." stuff.

that is on our (pre) prod environment. QA and DEV as DSUSER runs fine. (new 8.5 setup, pre-prod not officially prod yet, still working out some bugs like this)


Tested via command line, no scripts, no redirecting output.


SLES 11, Grid Enablement Toolkit 4.1.5 with tweeks.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Any permission difference on orchadmin across servers or group membership differences on the IDs?
Choose a job you love, and you will never have to work a day in your life. - Confucius
PaulVL
Premium Member
Premium Member
Posts: 1315
Joined: Fri Dec 17, 2010 4:36 pm

Post by PaulVL »

Nope, like I said, "orchadmin" works (returns text to stdout / stderr), "orchadmin rm" doesn't. It just goes back to prompt. And only for dsuser, not dsadm. Works in DEV/QA failing in PROD. Same release level of code, same release level of Grid Toolkit, different servers and code install.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

What are the differences between dsuser and dsadm, like their groups, their profiles, their ulimits, their environment variable settings, etc.? Is there a setting that affects stdout / stderr?
Choose a job you love, and you will never have to work a day in your life. - Confucius
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

If you have figured it out, I would be curious to know what it was.
Choose a job you love, and you will never have to work a day in your life. - Confucius
Post Reply