检查tar版本的shell脚步checktar.sh
来源:互联网 发布:淘宝定制包 编辑:程序博客网 时间:2024/06/05 03:00
#检查tar包
#tarpath=/bauser/sul/current/cc
tarpath=$HOME
:<<!
如果有2个参数,第一个参数为日期,比如20161025,第二个参数为tar包序号;
如果有1个参数,日期默认为当日,从系统获得,第一个参数为tar包的序号;
如果有0个参数,日期默认为当日,从系统获得,tar包序号默认为1
!
if [ $# -ge 3 ]
then
echo "输入参数不正确,只允许输入两个以内!"
exit 1
fi
if [ $# -eq 2 ]
then
date1=$1
num=$2
elif [ $# -eq 1 ]
then
date1=`date +%Y%m%d`
num=$1
else
date1=`date +%Y%m%d`
num=1
fi
echo "date1="$date1" num="$num" tarfile=\c"
tarfile=`echo $tarpath"/"$date1"inbu0"$num".tar"`
echo $tarfile"\c"
if [ "`ls $tarfile 2>/dev/null`" = "" ]
then
echo "不存在"
exit 1
else
echo ""
fi
echo "~~~~~~~~~~~~~~~~~~~~进行检查tar包~~~~~~~~~~~~~~~~~~~~~~"
mkdir tarTmp
cat versionlist.txt | while read line
do
v1=`echo $line | awk '{if($1~/^r/){print $1}else{print "r"$1}}'`
echo $v1"\c"
v2=`echo $line | awk '{print $2}'`
echo "\t"$v2"\t\tchecking..\c"
if [ "`tar tvf $tarfile | grep $v2`" = "" ]
then
echo "........不存在在tar包中,请检查tar包"
break
else
echo "..\c"
fi
if [ "`svn st $v2`" = "" ]
then
svn up -$v1 $v2 >/dev/null 2>&1
echo "..\c"
cd tarTmp
tar xvf $tarfile $v2 >/dev/null 2>&1
echo "..\c"
if [ "`diff $HOME/$v2 $HOME/tarTmp/$v2`" = "" ]
then
echo "..OK!"
else
diff $HOME/$v2 $HOME/tarTmp/$v2 | sed "s/^\>/\+/g" | sed "s/^\</\-/g" >> diff.txt
echo "..FAIL!"
fi
cd
else
echo $v2"....存在未提交版本,请检查!"
fi
done
echo "~~~~~~~~~~~~~~~~~~~~检查完毕~~~~~~~~~~~~~~~~~~~~~~~~~~~"
rm -r tarTmp
#tarpath=/bauser/sul/current/cc
tarpath=$HOME
:<<!
如果有2个参数,第一个参数为日期,比如20161025,第二个参数为tar包序号;
如果有1个参数,日期默认为当日,从系统获得,第一个参数为tar包的序号;
如果有0个参数,日期默认为当日,从系统获得,tar包序号默认为1
!
if [ $# -ge 3 ]
then
echo "输入参数不正确,只允许输入两个以内!"
exit 1
fi
if [ $# -eq 2 ]
then
date1=$1
num=$2
elif [ $# -eq 1 ]
then
date1=`date +%Y%m%d`
num=$1
else
date1=`date +%Y%m%d`
num=1
fi
echo "date1="$date1" num="$num" tarfile=\c"
tarfile=`echo $tarpath"/"$date1"inbu0"$num".tar"`
echo $tarfile"\c"
if [ "`ls $tarfile 2>/dev/null`" = "" ]
then
echo "不存在"
exit 1
else
echo ""
fi
echo "~~~~~~~~~~~~~~~~~~~~进行检查tar包~~~~~~~~~~~~~~~~~~~~~~"
mkdir tarTmp
cat versionlist.txt | while read line
do
v1=`echo $line | awk '{if($1~/^r/){print $1}else{print "r"$1}}'`
echo $v1"\c"
v2=`echo $line | awk '{print $2}'`
echo "\t"$v2"\t\tchecking..\c"
if [ "`tar tvf $tarfile | grep $v2`" = "" ]
then
echo "........不存在在tar包中,请检查tar包"
break
else
echo "..\c"
fi
if [ "`svn st $v2`" = "" ]
then
svn up -$v1 $v2 >/dev/null 2>&1
echo "..\c"
cd tarTmp
tar xvf $tarfile $v2 >/dev/null 2>&1
echo "..\c"
if [ "`diff $HOME/$v2 $HOME/tarTmp/$v2`" = "" ]
then
echo "..OK!"
else
diff $HOME/$v2 $HOME/tarTmp/$v2 | sed "s/^\>/\+/g" | sed "s/^\</\-/g" >> diff.txt
echo "..FAIL!"
fi
cd
else
echo $v2"....存在未提交版本,请检查!"
fi
done
echo "~~~~~~~~~~~~~~~~~~~~检查完毕~~~~~~~~~~~~~~~~~~~~~~~~~~~"
rm -r tarTmp
0 0
- 检查tar版本的shell脚步checktar.sh
- 传输tar报到目的端的shell脚本ftp_tar.sh
- 以version.txt为文件列表的配置文件,进行tar包的shell脚本tar.sh
- 清理缓存的shell脚步
- shell 脚步
- shell 脚步获取当前的函数名
- Linux下各种软件版本的安装方法如以.rpm,.sh,.tar,.tar.bz2等等结尾的文件的安装
- linux_reboot.sh 的shell脚本
- [linux]shell脚步记录
- 一些常用shell脚步
- CMake调用shell脚步
- shell 脚步分析数据
- 检查JMF的版本
- 检查MySql的版本
- shell中while的使用 (ex26.sh,ex26a.sh)
- 记录2——检查 patch 升级之后的各种版本shell script
- tar: 从成员名中删除开头的“/ ./sh.sh: line 9: /: is a directory
- linux C 执行shell脚步
- 规范化理论-函数依赖-范式-简单粗暴
- 关于C++中的指针应用
- 决策树(Python实现)
- web项目由jetty启动转成tomcat启动
- 为什么java没有多继承
- 检查tar版本的shell脚步checktar.sh
- 数据分析与数据挖掘在常规工作中的应用——基本统计量描述
- linux top 命令详解
- 栈的插入 删除
- DOS for命令详解
- 通信中使用的数据格式(xml,json,pb.msgpack)
- CSS3阴影 box-shadow的使用和技巧总结
- 传输tar报到目的端的shell脚本ftp_tar.sh
- CodeForces 750G. New Year and Binary Tree Paths