I did a manual installation of the latest openhab 2 build, but since manual installation nothing was added to init.d. What’s the best way to get the service auto started? A ln to start.sh? In the installation manual I only seem to find instructions for systemd… Can someone please share some light. Please!
What Linux distro are you running on?
So then my question is why you are not using the yum installation which handles all this for you?
Note that CentOS 7 switches to systemd so maybe now is the time to switch.
Somewhere in the init.d folder there will be a skeleton file that you can use to build up an init script to start OH. The big thing is to make sure start.sh is started by an openhab user. You may have to create the openhab user yourself if you haven’t already (did I mention the yum installer?). A quick Google search will provide additional details.
Cause I started manually since I just I wanted control. Of course I could
use yum, but this should be something trivial like ln -s. This part is left
out of the tutorial and my quick google didn’t provide the answer. I’ve
found some scripts, but don’t know if they are up to date. Thought that I
wasn’t the only one who run more things on my server and don’t have the
time to upgrade… But I’ll probably start over again with yum since manual
installation isn’t possible, fell on the finish line… come on isn’t there
someone out there who knows this!
sysVini hasn’t been used in raspbian since weezy and other common distros that OH is most commonly deployed to for even longer. It is no longer the standard in CentOS either.
In short, sysVinit is deprecated so no one has bothered to port the old OH 1.8 scripts/instructions over to OH 2.
Then I would say you need to learn how to do this sort of thing. It isn’t hard. I pointed you at a couple of general directions. You just need to write the init.d script yourself. There should be a skeleton to write it in init.d already so you don’t even have to start from scratch. But if you really want control, that means you have to take on tasks like this yourself. You can both have control and have the community do everything for you so you can just
You just need to create the openhab system user, use the skeleton init.d script to write an openhab script that calls start.sh as the openhab user.
The quick google I was referring to was how to write an init.d script yourself.
I’ll say it again, if you want that kind of control you have to take on these sorts of tasks.
No one said it is impossible. Just that you will have to do some research to figure out how to do it yourself. I haven’t touched an init.d script in a couple of years if not longer. I simply have no memory of how to write one. But if you can figure out how to run OH from the command line, you should be able to figure out how to write an init.d script.
Though I think that the apt/yum install still supports systeVinit, perhaps you can find a working script in on of the OH repos, though that is going to expect certain things to be set up and configured that the installers do that will not exist for your manual install (environment variables, different paths for things, etc.).
Or another option is you can run OH in a VM or Docker container and bypass the whole problem.
Hi @Johan_Lund, openhab/openhab-linuxpkg includes a init script for RPM based systems, you can take a look at it here. Lines 16-31 need to be changed to suit your requirements, just write in your relevent paths!
Let me know if it works for you!
Yes that was exactly what I needed. For other users of older systems I can
tell you that I have successfully migrated from 1.8 to 2.1 and everything
works it’s up and running and seems very stable on CentOS 6.5. Thanks!