file name : backup.bat
===================================
cd C:\cygwin\home\vincent\mybin
bash backup_vobs.sh
===================================
file name : backup_vobs.sh
#!/bin/bash -
#####################################################################
if [ -e backup_$$.tmp ]; then
rm -f backup_$$.tmp
fi
touch backup_$$.tmp
#####################################################################
echo "list all the vobs within the clearcase (start)"
cleartool lsvob | sed 's;*; ;g' | awk -F' ' '{print $1}' | sed 's;\\;/;g' | tee backup_$$.tmp
echo "list all the vobs within the clearcase (ended)"
#####################################################################
echo "lock all the vobs for later backup data (start)"
for i in `cat backup_$$.tmp`
do
echo "------------->" $i
cleartool lock vob:$i
done
echo "lock all the vobs for later backup data (ended)"
#####################################################################
echo "starting compress the data from the \"ClearCase_Storage\" to \"ClearCase_Storage.zip\" (using the 7z tool)"
pushd .
folder_backup="D:\\data_backup"
folder_source="D:\\ClearCase_Storage"
zip_name="ClearCase_Storage"
mkdir -p $folder_backup
cd $folder_backup
"C:\\Program Files\\7-Zip\\7z" a -bd -r -tzip $zip_name $folder_source
echo "the zip packet named ClearCase_Storage.zip is generated under `pwd`"
popd
echo "finished compress the data from the \"ClearCase_Storage\" to \"ClearCase_Storage.zip\" (using the 7z tool)"
#####################################################################
echo "unlock all the vobs for later backup data (start)"
for i in `cat backup_$$.tmp`
do
echo "------------->" $i
cleartool unlock vob:$i
done
echo "unlock all the vobs for later backup data (ended)"
#####################################################################
rm -f backup_$$.tmp
#####################################################################
阅读(778) | 评论(0) | 转发(0) |