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?
 
ozoCommented:
what does /usr4/edi/edi_script/check_connect_direct.tandem do?
0
 
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
0
 
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.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
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?
0
 
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:)
0
 
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
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.