svn 自動更新コード

ファイル名:svn_update.sh
ソースコード:
#!/usr/local/bin/bash
export LANG=en_US.UTF-8
REPOS="$1″
REV="$2″
TXN_NAME="$3″
public_name=${REPOS##*/}
#mailer.py commit “$REPOS" “$REV" /path/to/mailer.conf
###########cmd
svn="/usr/local/bin/svn"
svnlook="/usr/local/bin/svnlook"
rsync="/usr/local/bin/rsync"
##########svnパス
svnpath=$REPOS
#####################webpath
srcweb="/home/tmp/$public_name"
dstweb="192.168.7.36::webconfig"

####################
if [[ ! -d $srcweb ]];then
#$svn co –username root –password startnews24 file://${REPOS} $srcweb
#$svn co file://${REPOS} $srcweb
echo “$svn co file://${REPOS} $srcweb:yes" >>/home/tmp/$public_name.log
fi

for i in $($svnlook changed $svnpath|awk '{print $2}’)
{
#$svn update -N “${srcweb}/$i"
#python /bin/svn_update $srcweb/$i
echo " $svn update -N ${srcweb}/$i:yes" >>/home/tmp/$public_name.log
}

echo “$rsync -avzP –delete –exclude=’.svn’ –password-file=/etc/rsyncd.secrets $srcweb $dstweb >>/var/log/svn_rsync.log:yes" >>/home/tmp/$public_name.log

############svn更新
#!/usr/bin/env bash
export LANG=en_US.UTF-8
exec()
{
dir=$( ls /home/tmp/*.log)
for i in $dir
{
echo $i
cat $i |awk -F:yes '{print $1}’|bash
rm $i
}
}

while (( 1 ))
do
{
exec
sleep 2
}
done

Source

Posted by arkgame