Setup Homebridge to Start on Bootup
I’ve recently been playing with Homebridge on my Raspberry Pi . I’ve setup my Harmony Hub and my wireless power outlets to be controlled by Siri on my iPhone. Overall it has been pretty simple to setup but I did run into an issue trying to get Homebridge to start onbootup. Homebridge suggest 3 different methods .
I decided to use systemd to start Homebridge on bootup. I prefered this method because it will restart if an error occurs. I followed the gist setup step by step but ran intosome problems.Mymain issues were: The location of my homebridge binary. Step 2 Permissions were not correct and the service failed to load. Step 7 I needed the persist folder in /var/homebridge directory. Step 6 Here are the steps that worked for me: sudo nano/etc/default/homebridge and paste this gist sudo nano /etc/systemd/system/homebridge.service and paste this gist I had to remove local from: ExecStart=/usr/local/bin/homebridge $HOMEBRIDGE_OPTS because my homebridge installed in /usr/bin/ Create a user to run service: useradd system homebridge sudo mkdir /var/homebridge sudo cp ~/.homebridge/config.json /var/homebridge/ This copies your current user’s config. This assumes you have already added accessories etc. sudo cp -r ~/.homebridge/persist /var/homebridge sudo chmod -R 0777 /var/homebridge sudosystemctl daemon-reload sudo systemctl enable homebridge sudo systemctl start homebridge
Type systemctl status homebridge to check the status of the service.
Hopefully this helps anyone who is having trouble with Homebridge starting on boot on a Raspberry Pi. Please comment below if you have any questions.
本文系统（linux）相关术语:linux系统 鸟哥的linux私房菜 linux命令大全 linux操作系统