Page 1 of 1

Logging the output of orchadmin command

Posted: Wed Jan 04, 2012 11:21 am
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?

Posted: Wed Jan 04, 2012 11:31 am
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 .

Posted: Wed Jan 04, 2012 12:27 pm
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.

Posted: Wed Jan 04, 2012 2:58 pm
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.

Posted: Wed Jan 04, 2012 3:03 pm
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.

Posted: Thu Jan 05, 2012 8:57 pm
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?

Posted: Thu Jan 05, 2012 10:09 pm
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.

Posted: Thu Jan 05, 2012 10:19 pm
by qt_ky
Any permission difference on orchadmin across servers or group membership differences on the IDs?

Posted: Fri Jan 06, 2012 8:08 am
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.

Posted: Fri Jan 06, 2012 8:26 am
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?

Posted: Sat Jan 21, 2012 10:11 pm
by qt_ky
If you have figured it out, I would be curious to know what it was.