同事要使用svn进行代码开发,
而web上要即使在svn更新代码过后从svnserver上checkout最新代码,以便同事能立即看到svn上的新提交的代码效果。
#!/bin/bash
dir=/var/www/test_php/video_php
url=svn://192.168.0.112:/video_php
while true
do
oldversion=`svn info $dir | grep Revision|awk -F: '{ print $2}'`
echo $oldversion
newversion=`svn info $url | grep Revision|awk -F: '{ print $2}'`
echo $newversion
if [ "$newversion" != "$oldsvn_version" ]; then
svn update $dir
if [ $? -ne 0 ];then
echo "update $oldversion to $newversion failure!!!"
fi
fi
sleep 30
done
转载于:https://blog.51cto.com/liran728729/1194837