Skip to content

Instantly share code, notes, and snippets.

@andrewodri
Created January 30, 2020 19:56
Show Gist options
  • Save andrewodri/8dabf9c0e1fc23fd37335abf82cd38b4 to your computer and use it in GitHub Desktop.
Save andrewodri/8dabf9c0e1fc23fd37335abf82cd38b4 to your computer and use it in GitHub Desktop.
HomeBridge System Services
#!/bin/bash
rsync -avz -e 'ssh' --exclude='assets' --exclude='node_modules' ./ pi@raspberrypi:~/homebridge/
rsync -avz -e 'ssh' ~/.ssh/id_rsa.pub pi@raspberrypi:~/.ssh/authorized_keys
ssh pi@raspberrypi
chmod 600 ~/.ssh/authorized_keys
mkdir ~/.homebridge
cd homebridge
npm install
sudo sh -c 'echo "[Unit]
Description=Homebridge Server
[Service]
PIDFile=/tmp/homebridge-99.pid
User=pi
Group=pi
Restart=always
KillSignal=SIGQUIT
WorkingDirectory=/home/pi/homebridge/
ExecStart=/usr/bin/npm start --prefix /home/pi/homebridge/
[Install]
WantedBy=multi-user.target" > /lib/systemd/system/homebridge.service'
sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge
journalctl -u homebridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment