Skip to content

Commit

Permalink
add env file for systemd unit (#949)
Browse files Browse the repository at this point in the history
  • Loading branch information
hre999 authored Nov 8, 2023
1 parent 00d3244 commit c944104
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
11 changes: 11 additions & 0 deletions BridgeEmulator/hue-emulator.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#CONFIG_PATH=/opt/hue-emulator/config
#HTTP_PORT=80
#HTTPS_PORT=443
#BIND_IP=0.0.0.0
#IP=0.0.0.0
#MAC=
#IP_RANGE_START=0
#IP_RANGE_END=255
#DECONZ=127.0.0.1
#DEBUG=false
#disableonlinediscover=false
4 changes: 3 additions & 1 deletion BridgeEmulator/hue-emulator.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Description=Hue Emulator Service
After=multi-user.target

[Service]
#User=diyhue
EnvironmentFile=-/etc/default/hue-emulator
Type=idle
Restart=always
RestartSec=30
Expand All @@ -11,7 +13,7 @@ StartLimitBurst=5

WorkingDirectory=/opt/hue-emulator
ExecStart=/opt/hue-emulator/HueEmulator3.py
ExecStop=/usr/bin/curl http://127.0.0.1/save
ExecStop=/usr/bin/curl -s http://127.0.0.1:${HTTP_PORT}/save
ExecStop=/bin/sleep 1

[Install]
Expand Down
2 changes: 2 additions & 0 deletions BridgeEmulator/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ esac

chmod +x /opt/hue-emulator/coap-client-linux
cp hue-emulator.service /lib/systemd/system/
cp hue-emulator.env /etc/default/hue-emulator
cd ../../
rm -rf diyHue.zip diyHue-$branchSelection
chmod 644 /lib/systemd/system/hue-emulator.service
chmod 644 /etc/default/hue-emulator
systemctl daemon-reload
systemctl enable hue-emulator.service
systemctl start hue-emulator.service
Expand Down

0 comments on commit c944104

Please sign in to comment.