]> source.dussan.org Git - vaadin-framework.git/commitdiff
Improved integration server shutdown
authorLeif Åstrand <leif@vaadin.com>
Mon, 24 Oct 2011 10:17:15 +0000 (10:17 +0000)
committerLeif Åstrand <leif@vaadin.com>
Mon, 24 Oct 2011 10:17:15 +0000 (10:17 +0000)
svn changeset:21785/svn branch:6.7

tests/integration_base_files/base.xml
tests/integration_base_files/cleanup.sh
tests/integration_base_files/lock_age.sh

index 5e4ff6d17614ce74db847655a99da76510977205..c27f3589b354e765c2b7fea0d8563007a05e89f4 100644 (file)
@@ -9,6 +9,7 @@
     <property name="JAVA_HOME" value="/usr/lib/jvm/default-java" />
        <property name="waitMinutes" value="3" />
     <property name="waitUrl" value="http://localhost:${serverPort}/demo/VAADIN/themes/reindeer/styles.css" />
+       <property name="shutdownWait" value="10" />
 
     
     <target name="afterDeploy">
                <exec executable="./stop.sh" >
                        <env key="JAVA_HOME" value="${JAVA_HOME}" />
                </exec>
-               <sleep seconds="15" />
+               <sleep seconds="${shutdownWait}" />
+       </target>
+       
+       <target name="force-shutdown">
+               <exec executable="./cleanup.sh" />
        </target>
        
        <target name="check-port">
         
        <target name="startup-and-deploy" depends="check-lock,check-port,unpack-server,deploy,startup" />
        
-       <target name="shutdown-and-cleanup" depends="shutdown,clean,release-lock" />
-        
+       <target name="shutdown-and-cleanup" depends="shutdown,clean,release-lock,force-shutdown" />
         
 </project>
index d2d54450703d16afd6d53e49ca56a84c92f00e77..2ee8968aae0a6892497145656c10f552ca3e2598 100644 (file)
@@ -1,6 +1,10 @@
 echo checking and killing open servers
-    
-ps x | grep -E bin/java | grep -v grep | grep -v get-lock | awk '{print $1}' > temp
+
+# Find all java processes, except
+# * grep, as we're running it
+# * get-lock, as that one is just waiting for this cleanup to happen
+# * shutdown-and-cleanup, as that could be the one we're running from 
+ps x | grep -E bin/java | grep -v grep | grep -v get-lock | grep -v shutdown-and-cleanup | awk '{print $1}' > temp
      
 #Read and kill processes marked to temp
 while read line
index 1808ec05dfe3f6833c0eca284cbc29283f094f0a..6b78acb590b1f75d6afa21dd21dba99a443576f2 100644 (file)
@@ -1,7 +1,9 @@
 #! /bin/bash
-if [ -a /home/integration/deploy/lock.file ]
+if lockfile -r0 -! /home/integration/deploy/lock.file &> /dev/null
  then
+  # If we could not get the lock, check how old the lock file is
   DATE=$(date +%s)
+  # What if the file is not there any more?
   LOCK_AGE=$(stat -c %Z /home/integration/deploy/lock.file)
 
   AGE=$[($DATE - $LOCK_AGE)/60]
@@ -13,4 +15,7 @@ if [ -a /home/integration/deploy/lock.file ]
 #    else
 #     echo lock.file is $AGE min old.
   fi
+ else
+   # If we got the lock, do a cleanup (releasing the lock) just in case something has still been left running
+   ./cleanup.sh &> /dev/null
 fi