#!/bin/sh
echo `date`” check log”
if [ -f /data/${acc}/log/svn_lock ];then
create_time=`ls –time-style=+%s -l /data/${acc}/log/svn_lock|awk ‘{print $6}’`
cur_time=`date +%s`
lock_force_release_time=`expr $create_time + 600`
if [ $lock_force_release_time -gt $cur_time ];then
echo `date`” no release lock yet”
exit
fi
rm -f /data/${acc}/log/svn_lock
killall svn
sleep 5
killall -9 svn
fi
touch /data/${acc}/log/svn_lock
echo `date`” begin update”
up_st1=0
rm -f /data/${acc}/log/up1.log
cd /data/${acc}/svndata/index
if [ $? -eq 0 ];then
/usr/local/svn/bin/svn update 2>&1 > /data/${acc}/log/up1.log
up_st1=$?
fi
echo `date`” begin update2″
up_st2=0
rm -f /data/${acc}/log/up2.log
cd /data/${acc}/svndata/cms_content
if [ $? -eq 0 ];then
/usr/local/svn/bin/svn update 2>&1 > /data/${acc}/log/up2.log
up_st2=$?
fi
rm -f /data/${acc}/log/svn_lock
echo `date`” update end”
should_alert=0
if [ $up_st1 -ne 0 ];then
should_alert=1
fi
if [ $up_st2 -ne 0 ];then
should_alert=1
fi
#check log have C flag
#email alert