Auto startup on OS X?

Got openHAB running nicely in the terminal on mac OS X, and my Hue lights are working. Great stuff so far.

But what I’m stuck with is best practice to get openHAB running in the background as system start up?

Are you running openHAB 2 or 1.9? For 2.0, the Getting Started instructions say to use the command ‘openhab:install-service’ at the Karaf console, but that never worked for me. The plist it generated had some obvious errors, but even fixing those, it would never run (and it didn’t look anything like a normal OS X Launch Daemon plist), so I created my own. Seems like this would work with earlier version too, it’s just calling the script.

This seems to work, but my install has been having some stability issues. I think those are due to issues with the software or with 10.11.4, not the service. Here’s what I have (put this in /Library/LaunchDaemons/ with ownership root:wheel and access rw-r–r--):

`<?xml version="1.0" encoding="UTF-8"?>

EnvironmentVariables _JAVA_OPTIONS "" KeepAlive Label openHAB ProcessType Background Program /opt/openhab/ RunAtLoad UserName openhab WorkingDirectory /opt/openhab `
1 Like

Here is the guide I followed for openHAB 1.x.

Tips and Tricks

1 Like

that’s pretty much what I did with 2.0, just that I created the .plist using LaunchControl rather than from those instructions, and used an “openhab” system user rather than root.

When i use this, my script *.sh in excuteCommandLine doesn’t work. Whereas when i start openhab in terminal ./ it’s working. I don’t know why.
Have you got any idea?

EDIT : it’s ok : I have added Environment variables /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin in my *.plist