if [ $? -eq 0 ]
then
mkdir -p ${BKUP_DIR} # make directory
echo "Database shut down.">> $LOG_FILE
else echo "not shutdown".>> $LOG_FILE
fi
if [ ! -d ${BKUP_DIR} ]
then
echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
exit 1
fi
echo "Previous Backup is being removed." >> $LOG_FILE
rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
echo "Cold backup being performed." >> $LOG_FILE
cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
echo "Cold backup of archive logs being performed." >> $LOG_FILE
The script above has absolutely no leading spaces. Is that really how the script looks, or was the formatting the result of cut-and-paste? I ask because the EOF terminator must be exactly that and no more:
cat <<EOF
This works!
EOF
cat <<EOF
This won't recognize the EOF below because of the leading spaces!
EOF
cat <<-EOF
Ah-ha, but the dash before EOF will strip leading tabs (from text and the EOF)
EOF
Of course, you also have mismatched backticks in your last "date" command:
echo 'ymd='date +%Y%m%d' >> $LOG_FILE
You don't need them at all! Try this:
date "+ymd=%Y%m%d" >> $LOG_FILE
Using backticks or $( ) should be functionally equivilant, although I find the latter easier to read.
It says unexpected end of file while looking for matching '{' in line 42
Syntex error in line 57 unexpected end of file. I followed the direction of you guys but it still getting error. I am actually trying to create seperate directory where i will dump alll database files everyday after it shut down. The directory name should be ymd format. I created the scripts as you can see. Just give me suggestions whether i can do any other way. I am new to UNIX. I appreciate your suggestions.
if [ $? -eq 0 ]
then
mkdir -p ${BKUP_DIR} # make directory
echo "Database shut down.">> $LOG_FILE
else echo "not shutdown".>> $LOG_FILE
fi
if [ ! -d ${BKUP_DIR} ]
then
echo "Not a directory: ${BKUP_DIR}">> $LOG_FILE
exit 1
fi
echo "Previous Backup is being removed." >> $LOG_FILE
rm ${BKUP_DIR}/${ymd-${seed}.gz >>$LOG_FILE
echo "Cold backup being performed." >> $LOG_FILE
cp /u01/app/oracle/admin/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz #copying database files into new dir
cp /u02/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
cp /u03/oradata/SEED/* ${BKUP_DIR}/$ymd-${cmsv}.gz
echo "Cold backup of archive logs being performed." >> $LOG_FILE