1
0
Fork 0

Add systemd service

This commit is contained in:
Joerg Elfring 2020-04-01 22:13:12 +02:00
parent ee9a73ff70
commit 235c8c7f91
2 changed files with 30 additions and 0 deletions

View file

@ -53,3 +53,8 @@ These topics can control the device:
- Run miotAirpurifierBridge.py
Set the environment `airpurifierConfigFile` to use a different configfile.
### systemd
The systemd folder conatins a systemd service that can be customized and dropped
into `/etc/systemd/system`. It assumes the `miotAirpurifierBridge.py` script is
located in `/opt/miotAirpurifierBridge/`

View file

@ -0,0 +1,25 @@
[Unit]
Description=Air Purifier Bridge
## If the broker is on the local machine, systemd can take care of starting the
## bridge after the (mosquitto) broker.
#After=mosquitto.service
[Service]
ExecStart=/usr/bin/python3 /opt/miotAirpurifierBridge/miotAirpurifierBridge.py
WorkingDirectory=/opt/miotAirpurifierBridge
## Select the configurationfile
Environment=airpurifierConfigFile=airpurifier.conf
Environment=PYTHONUNBUFFERED=1
Restart=always
RestartSec=30
Type=simple
User=nobody
[Install]
WantedBy=default.target