Chinaunix首页 | 论坛 | 博客
  • 博客访问: 943043
  • 博文数量: 116
  • 博客积分: 3923
  • 博客等级: 中校
  • 技术积分: 1337
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-23 01:22
文章分类

全部博文(116)

文章存档

2013年(1)

2012年(17)

2011年(69)

2009年(29)

分类: LINUX

2009-04-30 21:51:18

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

#####################################################################


阅读(720) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~