-
Notifications
You must be signed in to change notification settings - Fork 0
/
hb_systemd.sh
45 lines (36 loc) · 1.05 KB
/
hb_systemd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
echo " "
echo "--------------------------------------------------------------------"
echo "This script will install, systemd, autostart and restart at failure "
echo " for Homebridge "
# Get program location
where=$(which homebridge)
cat > /etc/systemd/system/homebridge.service <<EOL
# systemd service file to start Homebridge
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
Documentation=https://pysselilivet.blogspot.com/2020/01/homebridge-autostart-made-simple.html
[Service]
Type=simple
User=pi
ExecStart=${where}
Restart=always
RestartSec=10
KillMode=process
KillSignal=SIGINT
SyslogIdentifier=Homebridge
[Install]
WantedBy=multi-user.target
EOL
echo " "
echo "Starting daemon .... please wait"
echo " "
systemctl daemon-reload
systemctl enable homebridge
systemctl restart homebridge
echo " "
echo "Showing status "
echo "--------------------------------------------------------------------"
echo " "
systemctl status homebridge