need help about shell script

Hi expert

i wrote a shell scrip when i run it by cron i got this message in cron log file:
stty: standard input: Invalid argument

i did some search but i couldnt find any answer for that. could you pls help me
this ispart of  my scrip and error message shows  up after ping to server and before check bzy file. it seems this error doent interrupt the script from running.

#!/bin/sh

PATH=$PATH:/usr/bin:/usr/ucb:/usr/bin/X11:/usr/sbin:/sbin:/usr/etc:/etc:/usr/local/bin:/usr2/local/bin:/informix/bin:/usr2/reporting/cvs-bprpt/script:/usr2/reporting/bin:/usr4/faran/viewedi

EDIDIR=/usr4/faran
BIN=$EDIDIR/edi_script
ID=$1
FI=$2
PREFIX=$3
TIME_STAMP=`date +%H%M%S`
TMPDIR=$EDIDIR/cd_batch

tmpfile=$TMPDIR/$FI.dat  
OFILE=$PREFIX$TIME_STAMP.EDI  

THELOG=/usr2/logfile/edi_transcd.log

echo "oFile $OFILE"

# --------  check to see if there is a file ---------------/
cd $EDIDIR/files5

i=`ls *.$ID 2> /dev/null |wc -l `

if(test "$i" -eq 0) then
      echo "no such file"
      exit 0
fi
# ------- check connection to ftpserver  -----/
ping c2kaftqa.cucbc.com -c 4 2>>  $THELOG >> $THELOG
echo "connect to server $?"
if(test $? -ne 0)
then
   echo "edi_tocd:`date` - No connection to ftp server c2kaftqa.cucbc.com"  >> $THELOG
   sendmon 1 "edi_tocd: No connection to ftpserver BBSFTP, please check ftpserver A.S.A.P"
   exit 1
fi

# ------- check bzy file time stamp  -----/
/usr4/edi/edi_script/check_connect_direct.tandem $FI "bzy"

echo "check bzy $?"
if (test $? -ne 0 )
then
   echo "Please check edica$ID.bzy file under $FI on ftpserver, transmission has been hold"
   sendmon 1 "edi_tocd: Pls. check edica$ID.bzy file under $FI on ftpserver, transmission stopped"
   exit 1
fi

thanks a lot
Far22
Far22Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
what does /usr4/edi/edi_script/check_connect_direct.tandem do?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Far22Author Commented:
hi
sorry i forgot to take that part put. that part is not related to the error message.that file check bzy file and works fine.
i got that message "stty: standard input: Invalid argument" when i run the program through cron and it shows when trying to ping to the server.

thanks for your help
Far22
jmcgOwnerCommented:
When run as a cron job, your script does not have a controlling terminal defined. You need to track down what part of your environment is responsible for attempting to call the 'stty' utility. Ozo spotted the check_connect_direct script as a possible place where this is happening. Another possibility is that you have a shell that automatically tries to read .profile and it is attempting to execute commands from there (though that doesn't look likely in your case). Your 'sendmon' command might be another possibility.
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

TintinCommented:
What user does the cronjob run as?

Check in the .profile for that user and I'm sure you'll see some stty settings.

BTW:  Did you really mean to post in the Perl group?
ahoffmannCommented:
> stty: standard input: Invalid argument
at least one of your called scripts uses stty which is not possible in cron
(in short what others already said:)
Far22Author Commented:
thanks for the respond and usefull help.
sorry if i  post this in perl group. i didnt know where i can post my question.

thanks
Far22
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.