How can I close the karaf console without shutting down my openHAB instance?

I am using openHAB 2.4. on a Raspberry Pi and it works fine. I automatically start my openHAB instance by using the command sudo systemctl enable openhab2 and it works as well.

To open the Karaf console I use the command openhab-cli console. There is the logout command to close the console, but this will also shut down my openHAB instance as shown in the screenshot below:

Signout_karaf_console

I don’t know if this is a stupid question, but is there any command to just close the Karaf console without shutting down my openHAB instance?

That line is misleading. Logout will exit the konsole without shutting down openHAB.

2 Likes

Info only; when running on a Windows host, using the standard start.bat utility to load openHAB also opens the Karaf host. Issuing a logout stops openHAB.
Of course in Windows you just minimize the Karaf window and leave it be :smiley:

True, but in the OP the stayed he is running on an RPi and started OH with systemctl so that shouldn’t happen.

If you run OH as a Windows Service in Background the behaviour is different. In this case you can login via SSH and use the logout command from Karf console to just logout and it won’t stop OH.

Doesnt CTRL-D work in the windows enviroment?
I use CTRL-D to exit Karaf from a SSH terminal on my Rpi.

I’m sure it does.

The root of the problem here is the statement printed out when you log in implies that CTRL-D, system:shutdown, or logout commands will all shutdown openHAB. But if OH is started and running in the background and you log into the console using ssh or opehab-cli console, issuing CTRL-D or the logout commands only exits the console and does not shutdown openHAB.

1 Like

Thanks for clarification.

I experience the exact situation as described in the initial post: When starting openhab with “sudo openhab-cli start”, it starts and leaves the prompt in karaf console. It will then shutdown OpenHAB if I execute logout. How do I get past this issue? Can I start OpenHAB without having to restart the device and still not end up in karaf console?

It’s always best to open a new thread than to repopen a two year old thread.

Your problem is not exactly the same as the original post. The original poster is starting openHAB as a server per normal (sudo systemctl start openhab) or more likely just letting openHAB start up on it’s own since it gets configured to run as a service by default anyway when installed via apt on the RPi.

OP’s problem was after openHAB started up in the background and then logging into the Karaf console they couldn’t figure out how to log out of the console.

Your problem is that you are not starting openHAB as a service in the first place. It’s not running in the background so when you log out of the console you are exiting the program.

Notice that the original poster was running “openhab-cli console” to get into the console only after enabling openHAB to run as a service by running the command sudo systemctl enable openhab2.

So please open a new thread to work through that issue.

You are starting openHAB manually.