feat: systemd unit + env template + installer for MQTT bridge
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
|
||||
sudo install -m 0755 "$HERE/pos_briefing_mqtt.py" /usr/local/bin/pos_briefing_mqtt.py
|
||||
sudo install -d -m 0755 /etc/pos-briefing
|
||||
if [ ! -f /etc/pos-briefing/pos-briefing.env ]; then
|
||||
sudo install -m 0600 "$HERE/pos-briefing.env.example" /etc/pos-briefing/pos-briefing.env
|
||||
echo "!! Edit /etc/pos-briefing/pos-briefing.env and set MQTT_PASSWORD"
|
||||
fi
|
||||
sudo install -m 0644 "$HERE/pos-briefing-mqtt.service" /etc/systemd/system/pos-briefing-mqtt.service
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable pos-briefing-mqtt.service
|
||||
echo "Installed. Start with: sudo systemctl start pos-briefing-mqtt.service"
|
||||
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=POS Briefing MQTT bridge for Home Assistant
|
||||
Documentation=https://git.sethpc.xyz/Seth/POS-Automation
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=claude
|
||||
# MQTT_PASSWORD lives here, root-owned 0600, never committed.
|
||||
EnvironmentFile=/etc/pos-briefing/pos-briefing.env
|
||||
ExecStart=/usr/bin/python3 /usr/local/bin/pos_briefing_mqtt.py
|
||||
Restart=on-failure
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,5 @@
|
||||
# Copy to /etc/pos-briefing/pos-briefing.env (root:root 0600). Never commit the real file.
|
||||
MQTT_HOST=192.168.0.154
|
||||
MQTT_PORT=1883
|
||||
MQTT_USER=posbriefing
|
||||
MQTT_PASSWORD=CHANGEME
|
||||
Reference in New Issue
Block a user