Add systemd service
This commit is contained in:
parent
ee9a73ff70
commit
235c8c7f91
2 changed files with 30 additions and 0 deletions
|
@ -53,3 +53,8 @@ These topics can control the device:
|
||||||
- Run miotAirpurifierBridge.py
|
- Run miotAirpurifierBridge.py
|
||||||
|
|
||||||
Set the environment `airpurifierConfigFile` to use a different configfile.
|
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/`
|
||||||
|
|
25
systemd/airPurifierBridge.service
Normal file
25
systemd/airPurifierBridge.service
Normal 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
|
||||||
|
|
Reference in a new issue