Logging the output of orchadmin command
Moderators: chulett, rschirm, roy
Logging the output of orchadmin command
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?
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?
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.
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.
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?
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
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.
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.