Operating System - HP-UX
1748202 Members
2978 Online
108759 Solutions
New Discussion юеВ

Handling 'tty' messages in mail headers

 
SOLVED
Go to solution
Jeffrey Davis_1
Frequent Advisor

Handling 'tty' messages in mail headers

Hi all. I'm on a N-class w/UX-11.00
I get the following 'tty' related messages in my mail messages and am wondering how to strip them out without having any adverse effects on things. I'm thinking that they are effects from 'tty' lines in either /etc/profile or user ~/home/.profile files. Any advice on dealing with these would be helpful.
Thanks in advance,

i.e. messages in mail:
From root@nprod.mercermc.com ...
Date: ....
From: System <...>
Subject: cron

ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter
You have mail.
Not a terminal
stty: : Not a typewriter
stty: : Not a typewriter

2 REPLIES 2
Jeff Schussele
Honored Contributor
Solution

Re: Handling 'tty' messages in mail headers

Hi Jeffrey,

Good question - great name.

Your cron commands are "pulling" these msgs in as they spawn shells for execution.

See Clay's post from yesterday (Plan B):

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x21c20bce6f33d6118fff0090279cd0f9,00.html

Basically what you want to do is wrap a test for terminal around the commands in /etc/profile & ~user/home/.profile that are interactive & tset them

This would need to be done for any cron allowed user's .profile.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steve Steel
Honored Contributor

Re: Handling 'tty' messages in mail headers

Hi



You can do this

Enclose the interactive term commands with if !

if ( { test -t 0 } ) then
`
stty
tabs
anymore

endif

{ test -t 0 }will return true or false,0 or 1 status depending upon whether the file descriptor is associated with a terminal device. If not a terminal then dont do the terminal based commands.
See the man page for the test command.

Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)