Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Search Forums:



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-17-2002
Registered User
 

Join Date: Jan 2002
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
stty: tcgetattr: Not a typewriter

I'm using some shell script to do some routine checks on system. I put them in crontab. Every time script run, I'm getting strange mails:

Code:
Message-Id: <200201171232.AA26410@odb.odl.com>
Apparently-To: root

stty: tcgetattr: Not a typewriter
Not a terminal
stty: tcgetattr: Not a typewriter
stty: tcgetattr: Not a typewriter
Not a terminal
stty: tcgetattr: Not a typewriter
stty: tcgetattr: Not a typewriter


*************************************************
Cron: The previous message is the standard output
      and standard error of one of your cron commands.

My question is what command produces this messages, and how to get rid of them?

Thanks

Script:

Code:
#oracle path
OBIN="/u05/z05/app/oracle/product/7.3.4/bin"

# Path to configuration files
CFG_DIR="/u05/z05/app/oracle/product/7.3.4/db_mgmt/alert_scripts"

# List of non-default quotes from configuration file
QT=`cat $CFG_DIR/alert_tbs_quotes.cfg | awk '$1 !~ /#/ {print $1 " " $2 "~"}`

# Default limit of free space%
DFLT_PERC=20

i=0

add_msg()
{
  i=$(($i+1))

  MSG="${MSG}
$1 has $2% of free space, what is less than $3% safe quote.
It has to be expanded by ${5}MB from current ${4}MB to get above the quote.
"
}

# calculate data about tablespaces from Oracle
{
$OBIN/sqlplus -s $PWD <<EOF
set linesize 500
set pagesize 0
set verify off
set feedback off
select f.tablespace_name||' '||to_char(round(sum(free)/sum(total)*100))
||' '||to_char(sum(total))||' '||to_char(sum(free)) from
(select tablespace_name, file_id, sum(bytes) free from dba_free_space
 group by tablespace_name, file_id) f,
(select file# file_id, bytes total from v\$datafile) z
where z.file_id=f.file_id group by tablespace_name order by 1;
exit
EOF
} \
| \
{
while read TBS PERC SIZE FREE
do
  # trying to look for quotes in configuration file
  LMT=` print $QT | awk -v RS="~" -v T="$TBS" '{ if ( $1 == T )
   print $2}'`
  LMT=${LMT:-$DFLT_PERC}
  if (( $PERC < $LMT )); then
    add_msg "$TBS" "$PERC" "$LMT" "$(($SIZE/1024/1024))" "$(( ($SIZE*$LMT-$FREE*100)/(100-$LMT)/1024/1024))"
  fi
done
}

if [[ -n ${MSG:+1} ]]; then
MSG="This message was generated by alert notification system.
Tablespace(s) below has exceed free space quote and needs to be expanded.
You can specify special quote for particular tablespaces in
file $CFG_DIR/alert_tbs_quotes.cfg.
${MSG}
Have a nice day!"

/usr/bin/perl /u04/z04/home/email/send_email.perl  \
-from "OAPROD UNIX-BOX <odl@odl.com>" -to "$1" -subject "Tablespace(s) Alert" \
-text "$MSG"
fi

Sponsored Links
    #2  
Old 01-17-2002
Perderabo's Avatar
Unix Daemon (Adminstrator Emeritus)
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,679
Thanks: 26
Thanked 238 Times in 148 Posts
The error message tells you that the program is "stty". I don't see any "stty" stuff in that fragment of your script. But the usual cause is that someone is sourcing .profile in cronjob.

I think that scripts should stand on their own and comepletely define the environment as needed. But the .profile could be modified to only invoke stty if the shell is interactive.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
stty: tcgetattr: A specified file does not support the ioctl system call. vishal_ranjan UNIX for Advanced & Expert Users 9 05-30-2007 04:29 AM
stty tcgetattr errors Student37 UNIX for Dummies Questions & Answers 8 04-26-2007 01:02 PM
not a typewriter error jxh461 UNIX for Advanced & Expert Users 2 01-23-2006 03:43 PM
stty frank UNIX for Dummies Questions & Answers 1 11-08-2002 10:49 AM
stty: : Not a typewriter yls177 UNIX for Dummies Questions & Answers 4 11-06-2002 08:08 AM



All times are GMT -4. The time now is 05:08 AM.