diff --git a/scripts/kill_uaa.sh b/scripts/kill_uaa.sh index fa08acb7250..ad96029f2f7 100755 --- a/scripts/kill_uaa.sh +++ b/scripts/kill_uaa.sh @@ -1,3 +1,40 @@ #!/usr/bin/env bash -jps | grep Bootstrap | cut -f 1 -d' ' | xargs kill -HUP +# Search for jps command in the following order: +# 1. jenv +# 2. JAVA_HOME +# 3. PATH +find_jps_command() { + if command -v jenv >/dev/null; then + echo "$(jenv which jps)" + elif [ -n "${JAVA_HOME}" ]; then + echo "$JAVA_HOME/bin/jps" + elif command -v jps >/dev/null; then + echo jps + else + echo "jps command not found" + exit 1 + fi +} + +function main() { + local jps_command + 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" + sleep 1 + done + + $jps_command | grep Bootstrap + if [ $? -eq 0 ]; then + echo "Bootstrap is still running" + exit 1 + else + echo "Bootstrap has finished" + exit 0 + fi +} + +main "$@" diff --git a/scripts/show_security_chains b/scripts/show_security_chains new file mode 100755 index 00000000000..eca51b42ae4 --- /dev/null +++ b/scripts/show_security_chains @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +${script_dir}/tail_uaa_log -1000 | sed -n 's/.*DefaultSecurityFilterChain/DefaultSecurityFilterChain/pg;' | sed 's/,/\n /g' diff --git a/scripts/tail-uaa-log b/scripts/tail_uaa_log similarity index 53% rename from scripts/tail-uaa-log rename to scripts/tail_uaa_log index 7ea7621fc6b..95aa998b623 100755 --- a/scripts/tail-uaa-log +++ b/scripts/tail_uaa_log @@ -1,14 +1,15 @@ #!/usr/bin/env bash function main() { - local port="8080" + local port=${PORT:-8080} local log_file_path="${TMPDIR}uaa-${port}/logs/uaa.log" + local tailArg="${1:--F}" echo "Tailing log for UAA listening on '${port}':" - echo "# tail -F ${log_file_path}" + echo "# tail ${tailArg} ${log_file_path}" echo "" - tail -F "${log_file_path}" + tail ${tailArg} "${log_file_path}" } -main \ No newline at end of file +main "$@"