Database Reference
In-Depth Information
fi
chmod 770 ${TARGET_DIR}
if [ ! -d ${STAGE_DIR} ]; then
mkdir ${STAGE_DIR}
fi
chmod 770 ${STAGE_DIR}
}
function BackupConfigFile {
sourceFILE=${SOURCE_DIR}/${FILENAME}
stageFILE=${TARGET_DIR}/staging/${FILENAME}
targetFILE=${TARGET_DIR}/${FILENAME}
oldFILE=${targetFILE}.old
oldZIP=${oldFILE}.zip
DashedBreak
if [ -f ${sourceFILE} ]; then
if [ -f ${targetFILE} ]; then
echo "\nBacking up ${sourceFILE}\n"
cp -f ${sourceFILE} ${stageFILE}
if [ `diff ${stageFILE} ${targetFILE} | wc -l` -gt 1 ]; then
echo "\n\tExisting backup file will be renamed and gzipped\n"
if [ -f ${targetFILE} ]; then
## Get rid of older copies of both files
[ $oldZIP ] && rm -f ${oldZIP}
[ $oldFILE ] && rm -f ${oldFILE}
## Rename and gzip the latest backup copy
echo "\tRenaming the existing backup file\n"
mv ${targetFILE} ${oldFILE}
echo "\tGzipping that copy\n"
gzip -f ${oldFILE} --fast
chmod 600 ${oldZIP}
fi
echo "\nBacking up ${sourceFILE}\n"
mv ${stageFILE} ${targetFILE}
chmod 640 ${targetFILE}
echo "\n\tNew backup file moved into place\n"
else
echo "\n\tThe current copy of ${FILENAME} is identical to the backup copy\n"
rm -f ${stageFILE}
fi
else
echo "\n\tMaking a copy of ${sourceFILE}\n"
cp ${sourceFILE} ${targetFILE}
fi
echo "\n\t${sourceFILE} does not exist on this server\n\n"
Search WWH ::




Custom Search