I am writing a shell script which inside it execute a script --> start_all_oracle
it echo a message when executed --> do you wish to remove the log and pinlog files. we have to reply y/n. while executing directly we can give our option, but inside script how can I put the value as 'n' so execution will be successful
below is code.
it echo a message when executed --> do you wish to remove the log and pinlog files. we have to reply y/n. while executing directly we can give our option, but inside script how can I put the value as 'n' so execution will be successful
below is code.
Code:
#!/bin/sh
#
# @(#) % %
#
# Copyright (c) 1996 - 2006 Oracle. All rights reserved.
#
# This material is the confidential property of Oracle Corporation or its
# licensors and may be used, reproduced, stored or transmitted only in
# accordance with a valid Oracle license or sublicense agreement.
#
VERSION=7.4
PATH=/usr/bin:/bin:${PATH}
PINDIR=/opt/app/portal/7.4/pin
LOGDIR=/var/opt/app/portal/7.4/pin
START_LIST="dm_oracle dm_oracle1 dm_ifw_sync"
if [ -d ${LOGDIR} ]; then
for d in ${START_LIST} ; do
if [ -f "${LOGDIR}/${d}/${d}.log" ]; then
any="y"
fi
if [ -f "${LOGDIR}/${d}/${d}.pinlog" ]; then
any="y"
fi
done
fi
if [ "${any}" ]; then
echo "do you wish to remove the log and pinlog files?\c"
read ans
case ${ans} in
y|Y) echo "removing old log files...\c"
rm -rf ${LOGDIR}/*/*log*
echo "done"
;;
n|N) echo "leaving log files alone"
;;
q|Q) exit 0
;;
*) echo "eh? [y/n/q]"
exit 0
;;
esac
fi
for d in ${START_LIST} ; do
if [ -f "${PINDIR}/bin/start_${d}" ];then
( cd ${PINDIR}/bin ; ./start_${d} )
fi
done
# get rc from cm startup
exit $?
Moderator's Comments: | ||
|