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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

invoke oracle profile

Status
Not open for further replies.
Oct 9, 2003
174
US
Trying to invoke a user profile from within a script but getting errors. This error is only when I try to run the script via the cron. It runs fine manually. Any ideas?

SCRIPT:

/morgan/scripts-<deltekcp>->cat tt2
#!/bin/ksh
#
# SET GLOBAL VARIABLES
IP="10.10.28.55" # target ip
MYMSG_GD="./good.txt" # ouput for successful tests
MYMSG_BD="./bad.txt" # ouput for failed tests
DB="deltekcp griffon epay deltektc testcp" # database names
#
#
# SQL DB TEST
test -z "$ORACLE_HOME" && . /export/home/oracle/.profile # invoke the oracle environment
#
for x in $DB; do # is the listener running?
if [ `/u01/app/oracle/product/8.1.7/bin/tnsping $x | grep -c "^OK "` -ne 0 ]; then
echo "$x : up" >> $MYMSG_GD # Yes, echo message
else
echo "$x : down" >> $MYMSG_BD # No, echo message
fi
done



ERROR (sent to oracle mailbox):

Your "cron" job on enterprise
/morgan/scripts/tt2 2>&1

produced the following output:

stty: : No such device or address


 
You must have a stty call in the profile.
You may amend the profile like this:
tty -s && stty ...

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
PHV

found the entry in the .profile that is causing the error.

stty istrip

Do you know what that "stty istrip" is?

Also, with your fix do I put that in the .profile file or in the script itself? If in the script where? Im not sure if I need that istrip line in the .profile, so is that fix going to negate that line?

Sorry for so many question, bit of a newbie

Thanks
 
In the .profile, replace this:
stty istrip
By this:
tty -s && stty istrip

So the stty command is executed only if a tty is attached to the process.

stty istrip : Strip input characters to 7 bits

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top