Hunter的大杂烩 技术学习笔记

2012-06-26

发布脚本[2]

Filed under: 技术话题 — hunter @ 4:48 pm

#!/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

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress