Auto-starting openHAB 2 with Ubuntu

I saw there is a script available to auto start openhab 1 under linux.

I was wondering if anyone has a script or other means to auto start OH2. The script here: Start script for OH2 isn’t working for me.

This is the official documentation for that: http://docs.openhab.org/installation/index.html#registering-openhab-as-a-system-service-in-the-os

Is this working for you?

I’ve been using this for a while now and it works really well.

Only one downside I see, and it’s really not a big deal unless you pull new nightly builds frequently. When I install a new nightly build, I delete the runtime directory (along with userdata/cache and userdata/tmp) before unzipping the new build. Since install-service places the files in the runtime/karaf/bin directory, I have to do the install-service process every time I install a new build. It would be nice if there were a way to preserve the system service configuration (along with the links from /etc/systemd/system).

But other than that, this works great!

Thanks, that actually worked. I just couldn’t find the manual before.

Is it possible that the link “#registering-openhab-as-a-system-service-in-the-os” has changed. I could not find a description on how to setup the Pi to start Openhab 2 as a service on startup. Can somebody help?

Hello @Ion3, the openHAB 2 documentation is still in progress of writing and some articles may change and move. That’s what happened to the article you are looking for:

Dear Thom,

is this applicable for the Raspberry Pi? http://docs.openhab.org/installation/linux.html#service

It says “for a Linux init system based on systemd (e.g. Debian 8 / Ubuntu 15.x and newer)”.

Isn’t Raspbian Jessie “based on sysVinit (e.g. Debian 7 / Ubuntu 14.x and earlier)”?

Are you able to help to setup an automatically restart of openHAB on a Raspberry Pi?

Greetings,
Timo

Raspbian Jessie is based on Debian Jessie, which again is also known as Debian 8.
You got a fair point there, that this should be made more clear. I’ll see to it.

You would have been able to find out be simply trying to execute systemctl.

All you need is actually in the article and was tested by me the other day. Additionally I would recommend to go along the package repository path. I included the manual installation part just for completeness and non-debian based systems.

I am also working on a preconfigured Raspbian image which I’ll release for first testing in the next 2-7 days.

Hi, is the preconfigured Raspbian image already available? If it is finished already, please post the link? :grinning:

@ThomDietrich and @lon3 [edit: I hit return too fast]
just fyi in case you are not aware of this already, another activity for a preconfigured image was just recently announced:
https://community.openhab.org/t/openhabian-hassle-free-rpi-image/13379

Not sure whether it is comparable of course, but focused efforts might help bring more clarity to the developments.
Thanks!

Hey @Ion3, just as @lipp_markus said, the promised image is now available following the link.

Best luck and let me know of any problems you run into.