Operating System - HP-UX
1753774 Members
7254 Online
108799 Solutions
New Discussion

ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

 
Dennis Handly
Acclaimed Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

>I have edited and added the requested lines in /etc/profile and .profile.

>echo "In ~/.profile" 1>&2

>if [ ! "$VUE" ] && tty -s; then

 

>echo "In /etc/profile" 1>&2

>if tty -s

 

Leave out that "if".  I only had that to show you where to put that echo.  Move the echo up in both files.

 

>su - oraprod -c 'sh /u01/proddb/9.2.0/appsutil/scripts/PROD_gfhdbp/addlnctl.sh s top prod'

 

This will cause execution of the profile files (~oraprod/.profile) from your crontab.

Syedfurquan
Trusted Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

Hi Bill,

 

It looks I have confused you with my uploaded O/P. Here I am trying to explain you below what I actually did

 

# diff /home/oraprod/.profile /usr/newconfig/etc/skel/.profile
27,29d26
<
< #. /u01/proddb/9.2.0/PROD_gfhdbp.env
< . /home/oraprod/9i_profile

 

The user used to run the crontab is "oraprod" and I have edited its .profile as follows:

 

Original .profile of oraprod is in /home/oraprod/.profile

 

# more /home/oraprod/.profile

 

# @(#)B11.23_LR

 

# Default user .profile file (/usr/bin/sh initialization).

 

# Set up the terminal:

        if [ "$TERM" = "" ]

        then

                eval ` tset -s -Q -m ':?hp' `

        else

                eval ` tset -s -Q `

        fi

        stty erase "^H" kill "^U" intr "^C" eof "^D"

        stty hupcl ixon ixoff

        tabs

 

# Set up the search paths:

        PATH=$PATH:.

 

# Set up the shell environment:

        set -u

        trap "echo 'logout'" 0

 

...skipping...

 

# @(#)B11.23_LR

 

# Default user .profile file (/usr/bin/sh initialization).

 

# Set up the terminal:

        if [ "$TERM" = "" ]

        then

                eval ` tset -s -Q -m ':?hp' `

        else

                eval ` tset -s -Q `

        fi

        stty erase "^H" kill "^U" intr "^C" eof "^D"

        stty hupcl ixon ixoff

        tabs

 

# Set up the search paths:

        PATH=$PATH:.

 

# Set up the shell environment:

        set -u

        trap "echo 'logout'" 0

 

# Set up the shell variables:

        EDITOR=vi

        export EDITOR

 

#. /u01/proddb/9.2.0/PROD_gfhdbp.env

. /home/oraprod/9i_profile

 

 

Edited .profile in /home/oraprod/.profile as per your suggestion below:

 

 

# more /home/oraprod/.profile

 

echo "In $HOME/.profile"

#. /u01/proddb/9.2.0/PROD_gfhdbp.env

. /home/oraprod/9i_profile

 

 

Please let me know if it looks fine.

 

Hi Dennis,

 

As per your suggestion I have edited the /etc/profile and .profile as well.

 

Many thanks to both of you for the support.

 

Regards,

Syed

 

Regards,
Syed
Dennis Handly
Acclaimed Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

>Please let me know if it looks fine.

 

I don't see the changes??

What's in /home/oraprod/9i_profile?

Syedfurquan
Trusted Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

Hello Denis,

 

Sorry for the late response as I was on a long vacation so couldn't work on this issue.

As requested please find  O/p

 

#more /home/oraprod/9i_profile ORACLE_HOME=/u01/proddb/9.2.0 export ORACLE_HOME

ORACLE_SID=PROD export ORACLE_SID

PATH=$PATH:$ORACLE_HOME/bin; export PATH

PATH=$PATH:$ORACLE_HOME/OPatch; export PATH

LD_LIBRARY_PATH=/u01/proddb/9.2.0/lib:/usr/dt/lib:/usr/openwin/lib:/u01/proddb/9.2.0/ctx/lib; export LD_LIBRARY_PATH

TNS_ADMIN=/u01/proddb/9.2.0/network/admin/PROD_gfhdbp export TNS_ADMIN

 

I have reverted my /etc/profile and .profiel to teh original as I was getting soem other error after editing .

 

Please help.

 

Attaching /etc/profile and .profile also

 

Please help to fix this issue

 

Regards

Regards,
Syed
Dennis Handly
Acclaimed Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

>#more /home/oraprod/9i_profile

>ORACLE_HOME=/u01/proddb/9.2.0 export ORACLE_HOME

>ORACLE_SID=PROD export ORACLE_SID

>TNS_ADMIN=/u01/proddb/9.2.0/network/admin/PROD_gfhdbp export TNS_ADMIN

 

These three lines are missing the semicolon before the export keyword.

If you are using a real shell, you should switch to simpler ksh or POSIX shell export syntax:

export ORACLE_HOME=/u01/proddb/9.2.0

 

>In /etc/profile

/etc/profile[54]: Syntax error: `if' is not matched.

 

This is the junk that I mentioned in message #11 to remove:

if tty -s

 

>In ~/.profile

.profile[53]: Syntax error: `then' is not matched

 

Same here:

if [ ! "$VUE" ] && tty -s; then

Syedfurquan
Trusted Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

Hi,

 

Now after editing "/home/oraprod/9i_profile" it looks as below:

 

 

# more /home/oraprod/9i_profile

 

ORACLE_HOME=/u01/proddb/9.2.0;

export ORACLE_HOME

 

ORACLE_SID=PROD;

export ORACLE_SID

 

PATH=$PATH:$ORACLE_HOME/bin; export PATH

 

PATH=$PATH:$ORACLE_HOME/OPatch; export PATH

 

LD_LIBRARY_PATH=/u01/proddb/9.2.0/lib:/usr/dt/lib:/usr/openwin/lib:/u01/proddb/9.2.0/ctx/lib;

export LD_LIBRARY_PATH

 

TNS_ADMIN=/u01/proddb/9.2.0/network/admin/PROD_gfhdbp;

export TNS_ADMIN

 

 

Then after that I did

 

export ORACLE_HOME=/u01/proddb/9.2.0

 

Is it fine now? As mentioned in my last post I have reverted back my /etc/profile and .profile as old and attached for your reference.

 

Regards,

Syed

 

Regards,
Syed
Dennis Handly
Acclaimed Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

>Is it fine now?

 

Well, if you have two lines, you don't need that semicolon.

And if you don't get those syntax errors, you should be fine.

You can check for syntax errors by:

ksh -n file

 

>I have reverted back my /etc/profile and .profile as old

 

So you don't have any changes that Bill and I have mentioned that use "if tty -s; then" to condition the tty setting blocks?

Syedfurquan
Trusted Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

Hi,

 

>Yes it is in 2 lines

> After reverting to old scripts without semicolon i run teh commands as

 #ksh -n /home/oraprod/9i_profile

It came to # prompt without any error.

 

Now how can we resolve this issue?

Thanks for all your support and really apprecaite it.

 

Regards

Regards,
Syed
Dennis Handly
Acclaimed Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

>Now how can we resolve this issue?

 

What issue?  Your original one?  Bill and I already told you how to do it.

Syedfurquan
Trusted Contributor

Re: ttytype: couldn't open /dev/tty for reading | stty: : Not a typewriter

I tried with the provided steps by you and Bill and that also didn't help me.
Issue still persist

Regards
Regards,
Syed