这几天公司需要统计svn的相关数据,最后发现了statsvn这个工具可以实现要求,于是就测试了下,感觉还真的不错,为了能自动去生成一个库的统计,我就自己写了个超级简单的脚本,大家别见笑!!!!!!!!!!!!
#!/bin/bash
echo "Please enter the name of a library"
read library
mkdir /usr/local/apache2/htdocs/$library
svn checkout svn://10.10.1.64:4002/$library /usr/local/apache2/htdocs/tongji/$library --username xxx --password xxx
if [ $? = 0 ]
then
svn log --xml -v --username xxx --password xxx /usr/local/apache2/htdocs/tongji/$library >/usr/local/apache2/htdocs/tongji/$library/svn.log
if [ $? = 0 ]
then
java -jar /usr/local/apache2/htdocs/statsvn-0.7.0/statsvn.jar /usr/local/apache2/htdocs/tongji/$library/svn.log /usr/local/apache2/htdocs/tongji/$library -output-dir /usr/local/apache2/htdocs/$library
rm -rf /usr/local/apache2/htdocs/tongji/$library
else
exit 0
fi
else
exit 0
fi
echo "Please enter the name of a library"
read library
mkdir /usr/local/apache2/htdocs/$library
svn checkout svn://10.10.1.64:4002/$library /usr/local/apache2/htdocs/tongji/$library --username xxx --password xxx
if [ $? = 0 ]
then
svn log --xml -v --username xxx --password xxx /usr/local/apache2/htdocs/tongji/$library >/usr/local/apache2/htdocs/tongji/$library/svn.log
if [ $? = 0 ]
then
java -jar /usr/local/apache2/htdocs/statsvn-0.7.0/statsvn.jar /usr/local/apache2/htdocs/tongji/$library/svn.log /usr/local/apache2/htdocs/tongji/$library -output-dir /usr/local/apache2/htdocs/$library
rm -rf /usr/local/apache2/htdocs/tongji/$library
else
exit 0
fi
else
exit 0
fi
然后通过
http://ip/库名字/index.html来查看统计的web页面
转载于:https://blog.51cto.com/wiliiwin/511602