geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1041528 - /geronimo/sandbox/gawor/daily_build_scripts/gbuild.sh
Date Thu, 02 Dec 2010 18:57:17 GMT
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



Mime
View raw message