Skip to content

Instantly share code, notes, and snippets.

@tkintscher
Last active July 13, 2019 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tkintscher/8ee9aac086ea07660f0a7fe8e7567864 to your computer and use it in GitHub Desktop.
Save tkintscher/8ee9aac086ea07660f0a7fe8e7567864 to your computer and use it in GitHub Desktop.
user systemd service for homebridge (http://github.com/nfarina/homebridge)
[Unit]
Description=Homebridge
After=network-online.target deconz.service
[Service]
Type=simple
ExecStart=/usr/bin/homebridge
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=default.target
@tkintscher
Copy link
Author

tkintscher commented Jul 12, 2019

Place the above file in: $HOME/.config/systemd/user/homebridge.service
Then run:

# reload service files
systemctl --user daemon-reload

# enable service auto start
systemctl --user enable homebridge.service

# create lingering systemd process at startup (otherwise it will only start once the user logs in)
loginctl enable-linger $USER

# start daemon
systemctl --user start homebridge.service

Watch the log by running:

journalctl --user-unit homebridge

If you get an error message like Failed to connect to bus: Permission denied, the systemd --user instance is not running or the environment variables are not set properly. This happened to me when su-ing to the homebridge user. As a workaround try logging in directly as that user.

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