How to terminate/stop quarkus keycloak server version 17.x.x?

11.8k views Asked by At

Recently I downloaded the new version Keycloak 17.0.0 Quarkus distribution, unzipped and started the Keycloak server by running bin/kc.sh start-dev from my local $KEYCLOAK_HOME directory in a CygWin Bash window. The server is up and running and I have configured my initial admin user. I am also able to login to the Keycloak UI. There is no cloud environment yet, no fancy configuration, it's only the bare standalone quarkus impl.

Question: How can I gracefull stop/quit/terminate the Keycloak server process? (Ctrl+C does not help in this case, because this command is not really scriptable)

Before moving to v17 I started my experiments with v16.1.0 Wildfly distribution and I was using ${KEYCLOAK_HOME}/bin/jboss-cli.sh --connect --commands="shutdown,quit" to terminate the server. But v17 (quarkus) does not contain the jboss-cli.sh script.

4

There are 4 answers

1
mbareck7 On

This may not be a graceful stoppage/shutdown but we can still use it in a script until we find a better way.

fuser : an utility to identify processes using files or sockets

If CygWin bash supports Linux fuser command you can try : fuser -k 8080/tcp

Here is what I'm using on Linux

If keycloak is running on its default https port

sudo fuser -k 8443/tcp

If keycloak is running on its http default port

sudo fuser -k 8080/tcp 

If you running keycloak on some_custom_prot

sudo fuser -k some_custom_prot/tcp
0
Nathaniel Echols On

It looks like capturing the PID and killing that later will work in v17 (I'm not sure this was true for v15 and WildFly):

$ ./keycloak-17.0.1/bin/kc.sh start-dev --http-port=8080 > keycloak.stdout 2>&1 & echo "$!" > keycloak.pid
$ cat keycloak.pid | xargs kill -TERM
1
Nick Skorobahatyi On

Stop Linux: ./jboss-cli.sh --connect command=:shutdown

Windows: jboss-cli.bat --connect command=:shutdown

0
leo On

i think just closing the terminal will shut down the keycloak server. this is something i found in the web "As far as I can tell, there's no particular commmand to uninstall. Only stop the server and delete the keycloak folder. Unless you installed Keycloak through some package management system."