Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

solaris "stty: : Inappropriate ioctl for device" when reading file 2

Status
Not open for further replies.

sapatos

Programmer
Jan 20, 2006
57
AU
I've seen this error before and have found a number of threads discussing it however I've not seen anything similar with a solution to my issue, not sure if anyone can help.

I've a script that reads commands from a file. This is done in a while loop. Depending on certain fields read from the file the script performs various tasks.

One of these tasks is calling another script and passing in some parameters for it to run. At this point I get the "stty: : Inappropriate ioctl for device" message, but then the script completes successfully.

I found in a forum something which helped me isolate the issue and I believe its due to the redirection of STDIN whilst reading the file. Excerpt follows:

#loop through poll file and extract commands
while IFS=, read ID HOST_NAME DATABASE_NAME COMMAND RESULT_TYPE FREQUENCY LAST_RUN_DTE OUTPUT_TARGET
do

#Skip header,
if [ ${HOST_NAME} = "HOST_NAME" ]; then

continue
fi

${SCRIPT_DIR}/db_space_alloc_and_free.ksh ${1}

done < $FILE

The output I get everytime I try to run a sub-script is:

stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device

I'm guessing the number of errors indicates the number of times its reading the variables or something. Can someone advise a solution? I've been looking at saving the stty settings prior to the file read and then resetting it just before I call the script but i'm having no luck.

Regards,

sapatos
 
I suspect it's something in the script that's being called, not "how" it's being called. Can you post the code for [tt]db_space_alloc_and_free.ksh[/tt]?

Also, seeing the input file and the rest of the main script might help too.

 
good point. I've just tried it again with a test file that merely write "hi" to test.out. I get the same error:

stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
stty: : Inappropriate ioctl for device
but *3.

the format of the file its reading is:

JOB_CONTROL_ID, HOST_NAME, DATABASE_NAME, COMMAND,RESULT_TYPE, FREQUENCY, LAST_RUN_DTE, OUTPUT_TARGET
5,fsgdev10,OFSGUAT5,RUNS db_space_alloc_and_free.ksh,DB_SPACE_ALLOC_AND_FREE,24,11/03/2009 12:31:04,O


the db_space_alloc_and_free.ksh script runs a sqlplus command(Which i've removed for brevity:

JOB_CONTROL_ID=${1}


SCRIPT_SH="/home/isd/msimcox/GPM/script_paths"
BASEDIR=`sh_read BASEPATH ${SCRIPT_SH}`
LOG_DIR=`sh_read LOGPATH ${SCRIPT_SH}`
POLL_DIR=`sh_read DATAPATH ${SCRIPT_SH}`
C_LOGFILE=`sh_read C_LOGFILE ${SCRIPT_SH}`
P_LOGFILE=`sh_read P_LOGFILE ${SCRIPT_SH}`
SCHEMA_ORAERR_FILE=`sh_read SCHEMA_ORAERR_FILE ${SCRIPT_SH}`
SCHEMA_ORALOG_FILE=`sh_read SCHEMA_ORALOG_FILE ${SCRIPT_SH}`
DB_POLL_FILE=`sh_read DB_POLL_FILE ${SCRIPT_SH}`
UNIX_POLL_FILE=`sh_read UNIX_POLL_FILE ${SCRIPT_SH}`
DEBUG=`sh_read GPM_DEBUG ${SCRIPT_SH}`

SCHEMA_USER=`sh_read PMUS ${SCRIPT_SH}`
SCHEMA_PASSWORD=`sh_read PMPW ${SCRIPT_SH}`
SCHEMA_INSTANCE=`sh_read PMSERV ${SCRIPT_SH}`

SQLPLUS="`which sqlplus` -S"



${SQLPLUS} ${SCHEMA_USER}/${SCHEMA_PASSWORD}@${SCHEMA_INSTANCE} << SQL #>> ${LOG_DIR}/${P_LOGFILE}

WHENEVER SQLERROR EXIT FAILURE
WHENEVER OSERROR EXIT FAILURE

set serveroutput on


SELECT 'TRUNCATED FOR BREVITY' FROM DUAL;

END;
/

SQL


 
You may try this:
${SCRIPT_DIR}/db_space_alloc_and_free.ksh ${1} [!]</dev/tty[/!]

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV's solution will work when you're logged on, not if this is run from cron.

I suspect you're setting up an ORACLE environment somewhere along the execution of the script. Check out that environment setup script for an stty command, change that line as follows

now:
[tt]stty whatever ...[/tt]

modify:
[tt]tty -s && stty whatever ...[/tt]


HTH,

p5wizard
 
Thanks folks, worked a treat. unfortunately I don't have access to change the oracle setup files.
 
You have a command [tt]sh_read[/tt] that seems to be called about the same number of times that the error message is popping up. Does that have an [tt]stty[/tt] in it?


 
nope that script just identifies what environment its being called in and generates a config file name. no tty there
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top