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