1. the exclude script, it return 1 if the database is excluded, otherwise return 0.
more ./exclude_date.ksh
TODAY=`date +%Y%m%d`
EXCLUDEFILE=/home/oracle/dba/exclude.date
if [ -f $EXCLUDEFILE ] ; then
echo "exclude date file exists"
echo $TODAY
EXCLUDE=`grep $TODAY $EXCLUDEFILE|grep -c $1`
if [ $EXCLUDE -ne 0 ]; then
echo "today is excluded"
exit 1
else
echo "today is not excluded"
exit 0
fi
else
echo "exclude file does not exists for $1"
fi
echo "reach end of the script"
exit 0
2. the backup script calls the exclude script.
...
/home/oracle/dba/exclude_date.ksh $DB
if [ $? -eq 1 ] ; then
exit
fi
...
more ./exclude_date.ksh
TODAY=`date +%Y%m%d`
EXCLUDEFILE=/home/oracle/dba/exclude.date
if [ -f $EXCLUDEFILE ] ; then
echo "exclude date file exists"
echo $TODAY
EXCLUDE=`grep $TODAY $EXCLUDEFILE|grep -c $1`
if [ $EXCLUDE -ne 0 ]; then
echo "today is excluded"
exit 1
else
echo "today is not excluded"
exit 0
fi
else
echo "exclude file does not exists for $1"
fi
echo "reach end of the script"
exit 0
2. the backup script calls the exclude script.
...
/home/oracle/dba/exclude_date.ksh $DB
if [ $? -eq 1 ] ; then
exit
fi
...
Comments
Post a Comment