The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

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 04:43 PM
stty frank UNIX for Dummies Questions & Answers 1 11-08-2002 11:49 AM
stty: : Not a typewriter yls177 UNIX for Dummies Questions & Answers 4 11-06-2002 09:08 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-17-2002
Trusevich Trusevich is offline
Registered User
  
 

Join Date: Jan 2002
Posts: 6
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
  #2 (permalink)  
Old 01-17-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
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

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0