stty tcgetattr errors

Hi,
I have an app that runs Oracle 8.1.7 residing on a AIX 4.3 ML 10 . preiodically app sends out a status log like the one displayed below. Lately I have noticed this stty:tcgetattr message in the log. Script that writes this output calls sqlplus, gets the required count and writes output to file.
Question is what is causing this "stty: tcgetattr" message and how can i prevent it from occurring
Please let me know Thnx....

stty: tcgetattr: A specified file does not support the ioctl system call.
06/24 09:30:00 W: 0 M: 0/ L: 0 C: 2068/ 92303 F: 0/ R: 0 T: 2068
stty: tcgetattr: A specified file does not support the ioctl system call.
06/24 09:40:00 W: 0 M: 0/ L: 0 C: 2068/ 92303 F: 0/ R: 0 T: 2068
stty: tcgetattr: A specified file does not support the ioctl system call.

What usually causes a situation like this is a .profile file. People will load commands like:
stty intr ^c
or something into their .profile. And then Oracle people also put in stuff like
ORACLE_VARIABLE=something
export ORACLE_VARIABLE

Then they write a script that needs that oracle variable. So to make the script self-sufficient, they will run .profile with the dot command.

Then they run that script via cron and now there is no controlling terminal. The script runs .profile and .profile tries to run stty. Bingo.... you get that error message.

So check for that...

Thank You this is pretty cool...
profile has stty erase ^?, script inturn was running .profile.
I have removed stty erase ^? from .profile and no longer get the error. Now I will move towards trying to fix the script..

Thnx....

Well that's not a great solution. Now when the oracle user signs on, the erase character will be wrong.

I would move those environment settings into a file called .oracle_setup or something. Then put a
. ./.oracle_setup
in .profile and in any scripts that need it.

Hi,
Well thats exactly whats happening, all week i have been attending calls regarding dev and test engineers not being able to use the erase character.
I have the script below. Would appreciate if you could guide me with your valuable suggestions.

script runs in a cron every ten minutes:

#!/bin/ksh
#
# $Log: getStats,v $
# Revision 1.1.1.1 2004/0/07 15:02:26 vagabond
# This is an initial check-in of ARCEngine software into new CVS reporistory.
#

. ~colddba/.profile

DATE=`date +"%m/%d %H:%M:%S"`
W_COMPLETED=`echo 'select count() from queue where status=1 and sub_status=1;'
| sqlplus -S qmanager/qmanager | head -4 | tail -1`M_COMPLETED=`echo 'select count(
) from queue where status=2 and sub_status=1;'
| sqlplus -S qmanager/qmanager | head -4 | tail -1`
PG_MCOMPLETED=`echo 'select sum(page_count) from queue where status=2 and sub_st
atus=1;' | sqlplus -S qmanager/qmanager | head -4 | tail -1`
L_COMPLETED=`echo 'select count() from queue where status=3 and sub_status=1;'
| sqlplus -S qmanager/qmanager | head -4 | tail -1`
U_COMPLETED=`echo 'select count(
) from queue where status=5 and sub_status=1;'
| sqlplus -S qmanager/qmanager | head -4 | tail -1`
PG_COMPLETED=`echo 'select sum(page_count) from queue where status=5 and sub_sta
tus=1;' | sqlplus -S qmanager/qmanager | head -4 | tail -1`
FAILED=`echo 'select count() from queue where sub_status=2;' | sqlplus -S qmana
ger/qmanager | head -4 | tail -1`
PG_FAILED=`echo 'select sum(page_count) from queue where sub_status=2;' | sqlplu
s -S qmanager/qmanager | head -4 | tail -1`
RUNNING=`echo 'select count(
) from queue where sub_status=3;' | sqlplus -S qman
ager/qmanager | head -4 | tail -1`
TOTAL=`echo 'select count(*) from queue;' | sqlplus -S qmanager/qmanager | head
-4 | tail -1`
echo $DATE W:$W_COMPLETED M:$M_COMPLETED/$PG_MCOMPLETED L:$L_COMPLETED C:$U_COMP
LETED/$PG_COMPLETED F:$FAILED/$PG_FAILED R:$RUNNING T:$TOTAL

Ummm...

All well, with the . ./.oracle_setup solution.
But what if is the script is executed as follows:

su - sewiefr -c start_application.sh

The .profile is called anyway

If you follow my instructions, start_application.sh will set up everything it needs when it sources the .oracle_setup script. That means that there is no need to use "su -". That hyphen explicitly requests that the shell start up scripts be run. It is not news that the hypen works. So do not use the hyphen. Once again, everything that the script needs to run should be moved into .oracle_setup. And .profile should explicitly source .oracle_set_up. This means that you do not need .profile to run start_application.sh. Should you explicitly request that .profile be run anyway, yes, you are back to square 1. So don't do that. :stuck_out_tongue:

Ok, I have the same situation.
I changed the script to .oracle_setup so that I can avoid getting the stty error.
Now, I have another problem. My PATH variable on the .profile has ORACLE_HOME path too.

But, I just take that PATH to .oracle_setup , then, I am missing the path of all other executables like 'cat' etc...

So, I have to have the PATH variables set on BOTH the .profile and .oracle_setup.

Is there any other way other than my work around. I want to have PATH in just one place.

Thank you,
Rahul