chaunceygardiner / purple-proxy

Proxy server for PurpleAir air quality sensor. Serves current and archived readings which are averaged over a specified interval.
GNU General Public License v3.0
0 stars 1 forks source link

Systemd system file instead of init script #2

Open sjthespian opened 4 years ago

sjthespian commented 4 years ago

I put together a systemd service file instead of using an init script. It might be simpler to install and makes it a little easier to support multiple purpleairs (I have two for example -- an indoor and an outdoor).

# purple-proxy-01.service unit file
# Copyright (C) Daniel Rich <drich@employees.org>

[Unit]
Description=Proxy server for PurpleAir air quality sensor
After=network.target

[Service]
PIDFile=/run/purple-proxy-01.pid
TimeoutStartSec=0
ExecStart=/opt/purpleproxy-01/bin/purpleproxy-wrapper.sh --pidfile /run/purple-proxy-01.pid
Restart=always
Type=forking
WorkingDirectory=/opt/purpleproxy-01

[Install]
WantedBy=multi-user.target
WantedBy=weewx.service