diff --git a/scripts/kill_uaa.sh b/scripts/kill_uaa.sh index ad96029f2f7..e2a8564b15a 100755 --- a/scripts/kill_uaa.sh +++ b/scripts/kill_uaa.sh @@ -18,21 +18,43 @@ find_jps_command() { } function main() { + local pid local jps_command + local kill_count=5 jps_command=$(find_jps_command) - while $jps_command | grep Bootstrap; do - $jps_command | grep Bootstrap | cut -f 1 -d' ' | xargs kill -HUP - echo "Waiting for Bootstrap to finish" + pid=$($jps_command -vlm | grep Bootstrap | grep uaa | cut -f 1 -d' ') + if [ -z "$pid" ]; then + echo "No UAA process found" + exit 0 + fi + + echo Currently running UAA processes: + $jps_command -vlm | egrep "^${pid} " + echo + echo -n "Attempting to kill UAA process with PID=$pid: " + + while [ "$kill_count" -ge "0" ]; do + if ! $jps_command | egrep "^${pid} " > /dev/null; then + break + fi + echo -n . + kill -HUP "${pid}" || true sleep 1 + kill_count=$((kill_count - 1)) done - $jps_command | grep Bootstrap + if $jps_command | egrep "^${pid} " > /dev/null; then + echo -n " Forcibly killing: " + kill -9 "${pid}" || true + fi + + $jps_command | egrep "^${pid} " if [ $? -eq 0 ]; then - echo "Bootstrap is still running" + echo " Bootstrap is still running" exit 1 else - echo "Bootstrap has finished" + echo " Bootstrap has finished" exit 0 fi } diff --git a/uaa/build.gradle b/uaa/build.gradle index e8ea8a0ed79..eb17b6d9766 100644 --- a/uaa/build.gradle +++ b/uaa/build.gradle @@ -158,7 +158,15 @@ generateDocs { dependsOn(slate) } +//task declarations +tasks.register('killUaa', Exec) { + workingDir '../' + executable = 'scripts/kill_uaa.sh' +} + integrationTest { + dependsOn killUaa + filter { includeTestsMatching("org.cloudfoundry.identity.uaa.integration.*") includeTestsMatching("*IT")