Automate responses
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The
sun_erm_setup.ksh
Script
Remote Mirroring of an Oracle Database Using Data Replicator Software
C-31
echo "\n${B1}$ESTATUS ERROR(S)${EB} and ${B3}$WSTATUS
WARNING(S)${EB} occurred during this script execution!"
echo "\nPlease check the ${B3}$LOG${EB} and
${B3}$TRACE${EB}files!\n"
exit 2
else
echo `date +%T`" No Errors detected...GOOD!" >> $LOG
echo "No errors or warnings detected...${B2}GOOD!${EB}"
# Write command to $TRACE file for debugging
echo "# rm $RMT_LOG_DIR/$DB_NAME.trace" >> $TRACE
rm $RMT_LOG_DIR/$DB_NAME.trace >> $TRACE 2>&1
fi
echo "\nsun_erm.ksh script log file is ${B2}$LOG${EB}\n"
echo "DONE! -- Have a great day!\n"
exit 0
###################
# DONE! #
###################
The
sun_erm_setup.ksh
Script
#!/bin/ksh
# This script will read user inputs for variables needed for the
# sun_erm.ksh script and store them in a configuration file.
TMP_FILE[0]=./~tmp0.erm
TMP_FILE[1]=./~tmp1.erm
TMP_FILE[2]=./~tmp2.erm
TMP_FILE[3]=./~tmp3.erm
typeset -u ANS=N ANS2=N
typeset -i COUNTER=0 STATUS=0 CHOICE=0
typeset X TEMP
# Used to improve readability
B1=`tput setaf 1``tput setab 0`
B2=`tput setaf 2``tput setab 0`
B3=`tput setaf 3``tput setab 0`
B4=`tput setaf 4``tput setab 0`
EB=`tput sgr0`
# Function used to automate responses
prompt_usr ()
{
echo "Correct (Y or N)? [Y]\b\b\c"