Check location of homebridge
pi@raspberrypi:~/.homebridge $ which homebridge
/usr/bin/homebridge
Create file /etc/systemd/system/homebridge.service
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
[Service]
Type=simple
User=pi
ExecStart=/usr/bin/homebridge
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
Then Enable and run the service (first time) with the following commands:
sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge
You can check the status of the service by calling
sudo systemctl status homebridge
Check logs
sudo journalctl -u homebridge