Restart if openHAB crashes Linux service

Hi there.
I have installed openhab on Linux Ubuntu 16.04.
With openhabian-config and stable version.
Now i want to make a script to restart by crash like you can see it in the manuell installation. But the openhab2.service file already exists.
What can i do?
Thanks for help.

Why would you want to do a restart after a crash like the manual installation
Openhabian has already done that for you and that is why there is already a service file.

Hi Vincent.
Okay. But it doesn’t work. If habpanel or PaperUI crashes, i can’t open it by IP.
In my file explorer i can see the rights of the file by root/root and not openhab.
Can i change it?

Description=openHAB 2 - empowering the smart home



ExecStart=/usr/share/openhab2/runtime/bin/karaf $OPENHAB_STARTMODE
ExecStop=/usr/share/openhab2/runtime/bin/karaf stop

SuccessExitStatus=0 143



Yes you can

How can i check the file directorys are right.
Because i installed ubuntu and then use openhabian-config stable.
Or are they okay?
thanks for your help.

You can compare with that:

The opanHabian location are the same as the repository installation

Ah okay.
And what’s the environment file:


And in the manually install the stop command is a kill command. Here i have:
ExecStop=/usr/share/openhab2/runtime/bin/karaf stop
Is this okay?
(ExecStop=/bin/kill -SIGINT $MAINPID)

Since i have installed the system binding, openhab crashes every 3-5 days.
Can i test the restart after crash manually?

You can test althought I would recommend a full reboot.
What happens before OH crashes, what’s in the logs?
I have ubuntu too but I run the repo installation, not openhabian.
And I have had no problems with the system binding
If you see anything in the logs, post it on github as an issue.
If it doesn’t get solved, ask your self, do you REALLY NEED that binding over the reliability of your system?

I only use the logviewer and can’t see someting.
I don’t know the command for debug in karaf for the system binding.
Yes i only want to see the memory and cpu load, to see if it crashes by 100 % load.
Thanks fpr your help :slight_smile:

If you have persistence set-up then you can see what the cpu load and memory use were before the crash.
Remove the binding and see in the system still crashes after 3-5 days…

Okay. I have persistence fpr cpu load and memory. Good idea. I will test it.
Which command I can use at the karaf to see errors or can i see the error in the logview too?

Your logs are in: /var/log/openhab2
they are

events records changes and commands to items and things
openhab.log records changes and errors to the OH system and bindings

You can view these with a normal text editor

Cool, thanks.
Perhaps you can help me here too?
How can in implement the command
KERNEL==“hci[0-9]*”, SUBSYSTEM==“bluetooth”, RUN+="/usr/bin/hciconfig %k up"
to the bluetooth.cfg.
After starting this line and restart bluetooth service, the bluetooth status is okay.

Sorry, don’t know
It will not go in the openHAB bluetooth.cfg
But probably in the bluetooth linux init file
Did you search for “ubuntu bluetooth init configuration” on google, should come up with something to help. Sorry but I don’t use bluetooth

Okay. So much thanks for your help.