etwmc / Personal-HomeKit-HAP

This project will provide source code to build a HomeKit support accessories.
MIT License
236 stars 84 forks source link

Startup on boot raspberry #16

Closed rooi closed 9 years ago

rooi commented 9 years ago

Hi,

I've got a good setup with the dynamic fork and would like to start it at boot on my raspberry. Unfortunately it does not work using the way described in the wiki. One thing I noticed is that is starts using root user, perhaps this causes problems.

The controller file is created and the service seems running, however I cannot add the accessory on my phone.

Does anyone have an idea on what causes this problem? I tries to su - xbian in the homekit file located in the /etc/init.d, but it did not work (probably did something wrong though..)

Thanks! Roy

elvisimprsntr commented 9 years ago

Likely a file permission issue during the paring process.

Try adding --chuid root:root option to line 48

start-stop-daemon --start --quiet -b --chuid root:root --pidfile $PIDFILE --make-pidfile --exec $DAEMON -- \

elvisimprsntr commented 9 years ago

I assume you updated the daemon path on line 18

rooi commented 9 years ago

thanks @elvisimprsntr!

It was a permission issue indeed. I changed it to user xbian and also changed the path such that my lightapi can be located as well.

elvisimprsntr commented 9 years ago

Post the exact changes and I will update the wiki

gb160 commented 9 years ago

Hi, just wondering if there was any update on this? I'm trying to get this to run on boot on a pi, I've tried the suggestions above.

rooi commented 9 years ago

Hi,

Sorry for the late reply, I missed this one. I changed to the local user id like your said:

start-stop-daemon --start --quiet --chuid xbian:xbian --pidfile $PIDFILE --exec $DAEMON --test > /dev/null

Besides this, I needed to change the path such that it can find the programs I call from the PHK (lightwaverf and logitech harmony in my case). It probably is specific to my setup as well, but I changed it into:

PATH=/usr/local/bin/:/sbin:/usr/sbin:/bin:/usr/bin

Perhaps you can include some pointers in the wiki? Hope this helps someone

Roy