initial check-in

This commit is contained in:
2023-08-28 17:29:39 +02:00
commit c8a835cdae
6 changed files with 190 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
[Unit]
Description=BoschHomeAutomation 2 MQTT Gateway
After=multi-user.target
[Service]
Type=idle
Restart=always
RestartSec=30
StartLimitInterval=200
StartLimitBurst=5
WorkingDirectory=/opt/Mqtt2ThingBoardGateWay
ExecStart=/opt/Mqtt2ThingBoardGateWay/Mqtt2ThingBoardGateWay.py
ExecStop=/bin/sleep 1
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
mac=`cat /sys/class/net/$(ip route get 8.8.8.8 | sed -n 's/.* dev \([^ ]*\).*/\1/p')/address`
arch=`uname -m`
### installing bsh gateway
echo -e "\033[36m Installing BSH Gateway.\033[0m"
if [ -d "/opt/Mqtt2ThingBoardGateWay" ]; then
systemctl stop Mqtt2ThingBoardGateWay.service
cp Mqtt2ThingBoardGateWay.py /opt/Mqtt2ThingBoardGateWay/
cp example-key.pem /opt/Mqtt2ThingBoardGateWay/
cp example-cert.pem /opt/Mqtt2ThingBoardGateWay/
else
mkdir /opt/Mqtt2ThingBoardGateWay
cp Mqtt2ThingBoardGateWay.py /opt/Mqtt2ThingBoardGateWay/
cp example-key.pem /opt/Mqtt2ThingBoardGateWay/
cp example-cert.pem /opt/Mqtt2ThingBoardGateWay/
fi
cp Mqtt2ThingBoardGateWay.service /lib/systemd/system/
chmod 644 /lib/systemd/system/Mqtt2ThingBoardGateWay.service
systemctl daemon-reload
systemctl enable Mqtt2ThingBoardGateWay.service
systemctl start Mqtt2ThingBoardGateWay.service
echo -e "\033[32m Installation completed. Mqtt2ThingBoardGateWay is now up and running.\033[0m"

View File

@@ -0,0 +1,18 @@
#!/bin/bash
cd /tmp
echo -e "\033[36m Mqtt2ThingBoardGateWay Service.\033[0m"
systemctl stop Mqtt2ThingBoardGateWay.service
### Uninstalling Mqtt2ThingBoardGateWay
echo -e "\033[36m Uninstalling Mqtt2ThingBoardGateWay.\033[0m"
rm -rf /opt/Mqtt2ThingBoardGateWay/
systemctl disable Mqtt2ThingBoardGateWay.service
rm /lib/systemd/system/Mqtt2ThingBoardGateWay.service
systemctl daemon-reload
echo -e "\033[32m Uninstall complete!\033[0m"