Operating System - HP-UX
1758622 Members
2197 Online
108874 Solutions
New Discussion юеВ

stty::Not a typewriter error message in rc.log

 
SOLVED
Go to solution
sheevm
Regular Advisor

stty::Not a typewriter error message in rc.log

Hi all,

When I run a shell script which does start/stop of an application in /sbin/init.d I get this message. Does anyone out there know a fix?

The script basically does one command
case $1 in
start)
/usr/bin/su - user -c '/opt/bin/app start'
;;
stop)/usr/bin/su - user -c '/opt/bin/app stop'
;;
esac

Thanks
rajim

be good and do good
4 REPLIES 4
KapilRaj
Honored Contributor
Solution

Re: stty::Not a typewriter error message in rc.log

I have seen this in the past. I thought the reason could be it has no terminal attached to the process. It never created a problem to the shell scripts so I ignored it.
Nothing is impossible
James R. Ferguson
Acclaimed Contributor

Re: stty::Not a typewriter error message in rc.log

Hi:

By using the 'su - username' you are causing the user's profile to be sourced (read).

This has the advantage of adding the profile's variables to your environment just like logging into to the server, but has the disadvantage of treating the process as an interactive one. Since no terminal is associated with the process, you get the "not a typewriter" error.

If you look at your profile you will see unconditional calls to 'stty' and 'tset'. These commands are interactive with a terminal.

You can eliminate this problem by revising your profile to *conditionally* execute 'stty' and 'tset' commands by adding:

...
if [ -t 0 ]; then
...

If the test is true, the process is an interactive one; that is, a terminal is associated with it.

Another way to circumvent this problem is *not* to use 'su -' but rather only 'su'. In this case, your .profile is not sourced. In this case, however, you will have to provide ALL environmental variables you may need in your script or by sourcing (reading) a file containing them.

Regards!

...JRF...
sheevm
Regular Advisor

Re: stty::Not a typewriter error message in rc.log

Thanks for your help.
be good and do good
Pete Randall
Outstanding Contributor

Re: stty::Not a typewriter error message in rc.log

Example:

if [[ -t 0 ]]
then
eval ` tset -s -Q `
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
stty susp ""
stty dsusp ""
tabs
fi


Pete

Pete