Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc dev script improvements #2876

Merged
merged 4 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion scripts/kill_uaa.sh
Original file line number Diff line number Diff line change
@@ -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 "$@"
4 changes: 4 additions & 0 deletions scripts/show_security_chains
Original file line number Diff line number Diff line change
@@ -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'
9 changes: 5 additions & 4 deletions scripts/tail-uaa-log → scripts/tail_uaa_log
Original file line number Diff line number Diff line change
@@ -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
main "$@"
Loading