Operating System - HP-UX
1751701 Members
4963 Online
108781 Solutions
New Discussion юеВ

Error stty: "Not a typewriter" when rebooting server

 
SOLVED
Go to solution
mpaschali
Occasional Contributor

Error stty: "Not a typewriter" when rebooting server

Greetings all,

I have a problem with oracle's .profile (I think) It is producing the above error when I reboot the server.
Does anyone know a way around or a fix to this problem?

Thanks

Maria
8 REPLIES 8
A. Clay Stephenson
Acclaimed Contributor

Re: Error stty: "Not a typewriter" when rebooting server

Hi:

I suspect you have a startup script which is calling svrmgrl or lsnrctl.

Your script should redirect both stderr & stdout to a file.

If you are doing a su - oracle svrmgrl < myfile
change it to su oracle myscript
myscript should then set and export env vars and call svrmgrl while redirecting stdout & stderr. The su - sources the .profile which has the side effect of running commands like stty.


Clay
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: Error stty: "Not a typewriter" when rebooting server

Hi:

This is most commonly seen when you cron scripts involving an 'su - user -c script' syntax.

The 'su - user' causes the user's $HOME/.profile to be sourced (read). This is often desired to obtain $PATH and other environmental variables present in the profile. The problem is that the profile contains 'stty' commands for terminal settings. When there is no terminal, as with a cron-inititated run or with a boot startup script, then the "not a typewriter" message is generated. The message means you executed a program that expects to deal with a terminal and you have forced the program to deal with a different device.

This is not so much a problem as a nuisance. One way to avoid this is to put any PATH and environmental variables needed in your actual script or in there own file which can be sourced by your script (and by your $HOME/.profile too).

...JRF...
mpaschali
Occasional Contributor

Re: Error stty: "Not a typewriter" when rebooting server

Hi again,

thanks for the information it helps some.

I have the following as oracle's .profile.

# @(#) $Revision: 72.2 $
# Default user .profile file (/usr/bin/sh initialization).
#!/usr/bin/sh
# Set up oracle environment variavles

if [ -o interactive ]; then
# Interactive commands go here
stty erase ^h
stty erase ^?
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs
fi
# Non-interactive commands go here

export ORACLE_HOME=/u01/app/oracle/product/8.1.7
export ORACLE_BASE=/u01/app/oracle
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_SID=HELPDESK
export SHLIB_PATH=$ORACLE_HOME/lib

# Set up the search paths:
PATH=$PATH:$ORACLE_HOME/bin:/etc/:/usr/local/bin

# Set up the shell environment:
set -u
trap "echo 'logout'" 0

# Set up the shell variables:
EDITOR=vi
export EDITOR
export HISTFILE=~/.sh_history
export HISTSIZE=100

export DISPLAY=57.192.2.179:0.0

umask 022

# set up prompts
export PS1='$ORACLE_SID.'`whoami`@'$PWD $'
export PS2='$>'

My understanding was that
"
if [ -o interactive ]; then
# Interactive commands go here
stty erase ^h
stty erase ^?
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs
fi
"

was meant to take care of this problem. Oracle is using a Korn shell environment. Have I set it up wrong?

Maria
Victor_5
Trusted Contributor

Re: Error stty: "Not a typewriter" when rebooting server

You can get this message from many sources. Usually, the message means you executed a program that expects to deal with a terminal and you have forced the program to deal with a different device.

Also, in some programs, a call to stdio(3) sets an ERRNO that does not get cleared up. Then, if you get another error, this message also pops up.

Also, when you start cron, and when a person changes cron's FIFO (/usr/lib/cron/FIFO) to be a regular file (-rw-rw-rw-) instead of a pipe
(prw-------), the message can be appended to cronlog, and this can keep going until the system runs out of disk space. Kill cron, remove the FIFO, and restart cron. Cron creates a new FIFO the correct way.

In some cases, the message can mean nothing; just continue to work.

Hope this can helps.
James R. Ferguson
Acclaimed Contributor
Solution

Re: Error stty: "Not a typewriter" when rebooting server

Hi again:

Yes, you are on the right track. Try changing your "if [ -o interactive ]" to " if [ -t -eq 0 ]".

Regards!

...JRF...
mpaschali
Occasional Contributor

Re: Error stty: "Not a typewriter" when rebooting server

hi again,

I have tried your suggestion, but I am still getting this error
"
Output from "/sbin/rc2.d/S99dbora start":
----------------------------
Oracle Startup in progress
stty: : Not a typewriter
(c)Copyright 1983-1997 Hewlett-Packard Co., All Rights Reserved.
"

I have checked to see if the scripts have mysterious control character but I can't see any.

Any other suggestions?

I have rebooted the server sooo many times now that I am getting a bit desperate :).

thanks
mpaschali
Occasional Contributor

Re: Error stty: "Not a typewriter" when rebooting server

James

If you were in Sydney I would KISS you!!!

your a genius.

It worked (sort of) I am still getting the error message in my rc.log. I made some modifications to the script as well.

changed from

/usr/bin/su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart &"
/usr/bin/su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start &"

to

/usr/bin/su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart"
/usr/bin/su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start"

The database comes up and so does the listener.

Thanks heaps :)

If you got anymore suggestions on getting rid of that error in the rc.log my ears are wide open.

Thanks again

Maria
Michael Tully
Honored Contributor

Re: Error stty: "Not a typewriter" when rebooting server

It could be that your script is expecting to write out to a terminal. Try adding this to your script.

TTY=`tty`
if [ "$TTY" = "not a tty" ]
then
TTY=/dev/console
fi

HTH
Michael
Anyone for a Mutiny ?