Skip to content

Commit

Permalink
move trap handler to beginning of script
Browse files Browse the repository at this point in the history
  • Loading branch information
falcowinkler committed Jul 4, 2024
1 parent 3e835b4 commit c3c8adf
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ ARGS="$@"

KEYCLOAK_PID=$!

until /opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080 --realm master --user $KEYCLOAK_ADMIN --password $KEYCLOAK_ADMIN_PASSWORD; do
>&2 echo "Keycloak is unavailable - sleeping"
sleep 1
done

term_handler() {
echo "Termination signal received, stopping Keycloak..."
if [ $KEYCLOAK_PID -ne 0 ]; then
Expand All @@ -20,6 +15,11 @@ term_handler() {

trap 'term_handler' SIGTERM SIGINT

until /opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080 --realm master --user $KEYCLOAK_ADMIN --password $KEYCLOAK_ADMIN_PASSWORD; do
>&2 echo "Keycloak is unavailable - sleeping"
sleep 1
done

/opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080 --realm master --user admin --password $KEYCLOAK_ADMIN_PASSWORD
/opt/keycloak/bin/kcadm.sh create clients --server http://localhost:8080 -r master -f - <<-EOF
{
Expand Down

0 comments on commit c3c8adf

Please sign in to comment.