Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 37337 invoked from network); 2 Dec 2010 18:58:50 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Dec 2010 18:58:50 -0000 Received: (qmail 965 invoked by uid 500); 2 Dec 2010 18:58:50 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 919 invoked by uid 500); 2 Dec 2010 18:58:49 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 912 invoked by uid 99); 2 Dec 2010 18:58:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Dec 2010 18:58:49 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Dec 2010 18:58:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2969C23888E4; Thu, 2 Dec 2010 18:57:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1041528 - /geronimo/sandbox/gawor/daily_build_scripts/gbuild.sh Date: Thu, 02 Dec 2010 18:57:17 -0000 To: scm@geronimo.apache.org From: gawor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101202185717.2969C23888E4@eris.apache.org> Author: gawor Date: Thu Dec 2 18:57:16 2010 New Revision: 1041528 URL: http://svn.apache.org/viewvc?rev=1041528&view=rev Log: updated script to automatically try to restart a hung build Modified: geronimo/sandbox/gawor/daily_build_scripts/gbuild.sh Modified: geronimo/sandbox/gawor/daily_build_scripts/gbuild.sh URL: http://svn.apache.org/viewvc/geronimo/sandbox/gawor/daily_build_scripts/gbuild.sh?rev=1041528&r1=1041527&r2=1041528&view=diff ============================================================================== --- geronimo/sandbox/gawor/daily_build_scripts/gbuild.sh (original) +++ geronimo/sandbox/gawor/daily_build_scripts/gbuild.sh Thu Dec 2 18:57:16 2010 @@ -69,6 +69,8 @@ function send_mail() { subject=$1 mailto=$2 + echo $subject + mail_ts=`date +%Y%m%d%H%M%S` remote_mail_file=${REMOTE_HOME}/${mail_ts}.mail.txt scp mail.txt ${REMOTE_ACCOUNT}@${REMOTE_MACHINE}:$remote_mail_file @@ -79,16 +81,33 @@ function send_mail() { echo `date` > $BASE_DIR/date.log # check if another gbuild script is still running +counterFile=$BASE_DIR/running.count ps -ef > $BASE_DIR/ps.out count=`cat $BASE_DIR/ps.out | grep "gbuild.sh" | wc -l` -if [ $count -gt 1 ] -then - echo "Previous build is still running..." - subject="[BUILD] ${BRANCH}: Previous build did not complete" - echo "Previous build is still running..." > mail.txt +if [ $count -gt 1 ]; then + + if [ -f "$counterFile" ]; then + counter=`cat $counterFile` + counter=`expr $counter + 1` + echo $counter > $counterFile + + msg="Geronimo build is hung #$counter." + + if [ $counter -ge 4 ]; then + killall -3 java + sleep 30 + killall -9 java + + msg="Geronimo build is hung. Attempted to restart it." + fi + else + echo "1" > $counterFile + msg="Geronimo build is hung." + fi + + echo $msg > mail.txt + send_mail "[BUILD]: $msg" "$ADMIN_ADDR" - send_mail "$subject" "$ADMIN_ADDR" - exit fi ts=`date +%T | awk -F: '{print $1$2}'` @@ -101,10 +120,8 @@ rm -rf $BRANCH_DIR svn co https://svn.apache.org/repos/asf/geronimo/server/$BRANCH $BRANCH_DIR if [ $? -ne 0 ] then - echo "SVN checkout failed." subject="[BUILD] ${BRANCH}: SVN checkout failed" echo "SVN checkout failed." > mail.txt - send_mail "$subject" "$ADMIN_ADDR" exit fi @@ -236,4 +253,6 @@ else fi +rm $counterFile + exit 0