Skip to content

Instantly share code, notes, and snippets.

@toruta39
Forked from johannrichard/homebridge
Last active October 28, 2018 10:45
Show Gist options
  • Save toruta39/10340217cae95c66b614f5d18e4c8ecc to your computer and use it in GitHub Desktop.
Save toruta39/10340217cae95c66b614f5d18e4c8ecc to your computer and use it in GitHub Desktop.
Systemd Service for homebridge (http://github.com/nfarina/homebridge)

Systemd service for homebridge

Setup

sudo cp homebridge /etc/default
sudo cp homebridge.service /etc/systemd/system

Config

sudo useradd -M --system homebridge
sudo mkdir -p /var/lib/homebridge/plugins
sudo chmod -R homebridge:homebridge /var/lib/homebridge
# Put config.json to /var/lib/homebridge
# Clone plugins to /var/lib/homebridge/plugins

Run service (first time)

systemctl daemon-reload
systemctl enable homebridge
systemctl start homebridge

Check status

systemctl status homebridge

Check journal

journalctl -u homebridge
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/lib/homebridge -P /var/lib/homebridge/plugins
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
[Service]
Type=simple
User=homebridge
EnvironmentFile=/etc/default/homebridge
# Adapt this to your specific setup (could be /usr/bin/homebridge)
# See comments below for more information
ExecStart=/usr/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
@poliolet
Copy link

I think one command is wrong, it says chmod but it should me chown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment